Building PHP Composer Package
Firstly create an empty directory. Next, generate a composer file using the following command.
composer init
Next, you want to type the following details. Please consider Package Type as the library and give the license as MIT.
Next, inside the src folder create index.php and add the following code sample.
Next, push this directory as a GitHub repository.
Next, go to https://packagist.org/ and sign up using GitHub.
Next, click submit button on packagist home page. Add git hub repository URL and hit the check button.
Next, click submit button.
Finally, you can see your composer package is created successfully.
Finally, create a testing directory. Copy “composer require sanje/php-composer” command and after that paste this command inside this directory.
If you see this error. You can fix it by adding git tags following.
Next, try again to composer the command following.
Now you can create a simple index.php file inside the root directory and add the following code.
Open the testing project using the terminal and run index.php file. You can see your output.
References: https://github.com/sanju2/php-composer
Thank You!!!