You want to publish a PHP library created on packagist.org. What do you have to do?
1. Your library must contain a composer.json file
You can do this by running the composer init command to generate a composer.json file.
Here, you'll update your library data, such as author, library name, and more. As an example:
{
"name": "vendor_name/package_name",
"description": "My package is awesome",
"type": "library",
"require": {
"php": ">=7.3.0"
},
"license": "proprietary",
"authors": [
{
"name": "Vendor Name",
"email": "your@email.tld"
}
],
"minimum-stability": "dev"
}
For other information about composer.json proprieties you can be inspired by here.
2. Create an account on a platform git , GitHub / GitLab / Butbucket or any platform you are familiar with and publish the latest version of the code that works according to your expectations.
3. It`s required to write a readme file. Here you will find the necessary information about the library but also information about how to install and how to use.
4. Create an account at packagist.org and register the repository here.
Your library should be available at: https://packagist.org/packages/vendor_name/package_name
Hint! You can try to make package versioning using git tags. It will be useful for users to navigate through the source code and they are a benchmark for release points.
That`s simple, right?