Recently I was trying my hands to make my own package on Packagist. I have successfully made a project and uploaded it to GitHub on this link
GitHub - hitswa/composer-package-test: I am just trying to create a composer package[
^]
After doing so I successfully made project on Packagist
hiteshrohilla/common - Packagist[
^] but when I try to fetch it using composer it gives me the following error
composer requir hiteshrohilla/common
[InvalidArgumentException]
Could not find package hiteshrohilla/common.
Did you mean this?
hiteshrohilla/common
require [--dev] [--prefer-source] [--prefer-dist] [--no-progress] [--no-suggest] [--no-update] [--no-scripts] [--update-no-dev] [--update-with-dependencies] [--update-with-all-dependencies] [--ignore-platform-reqs] [--prefer-stable] [--prefer-lowest] [--sort-packages] [-o|--optimize-autoloader] [-a|--classmap-authoritative] [--apcu-autoloader] [--] [<packages>]...
What I have tried:
I tried to search and apply various solutions by searching on Google. however, I don't find much about it. One relevant result is
[
^] on stackoverflow.
I tried to check my composer.json file which is as follow
{
"name": "hiteshrohilla/common",
"description": "common files used in development of a php project",
"keywords": ["php","common"],
"type": "library",
"version": "1.0.0",
"minimum-stability": "stable",
"homepage": "http://hiteshrohilla.com/",
"require": {
"php": "^5.3.3 || ^7.0",
"ext-mysqli": "*"
},
"require-dev": {},
"conflict": {},
"repositories": [
{
"type": "path",
"url": "https://github.com/hitswa/composer-package-test.git"
}
],
"license": ["Creative Commons Attribution-ShareAlike 4.0 International License",
"Creative Commons Attribution 3.0 License"],
"authors": [
{
"name": "Er. Hitesh Kumar (Rohilla)",
"email": "rohilla.hitesh@gmail.com",
"homepage": "http://hiteshrohilla.com/",
"role": "Developer"
}
],
"support": {
"email": "rohilla.hitesh@gmail.com"
},
"time": "2018-01-15 00:00:00",
"autoload":{
"psr-4":{
"Hiteshrohilla\\":"src/Hiteshrohilla"
}
}
}
Please let me know what wrong I am doing and guide me and correct me.
======================================================================
UPDATE:
Now I am able to fetch the package from the composer. How? by following way
Step 01: I made an empty project directory where I want to fetch this package.
Step 02: Then I made a composer.json file and add following code to it
{
"name": "testapp",
"require": {
"hiteshrohilla/common": "dev-master"
}
}
Step 03: Then I run following command in terminal at this address of project directory
composer install
==========================================================
Well, I still think why I am unable to fetch the repository directly from composer CLI. Maybe because there is no release on GitHub.