1. First, you need to install composer locally, and configure the environment variables. Enter composer on the command line, and the following information is displayed, indicating a normal installation
2. Initialize composer in the root directory of the corresponding project on github
After the initialization is complete, a composer.json file will be automatically added to the directory
Then submit the composer.json file to github
Submit this because packagist corresponds to the project on github based on this json file.
3. Log in to your packagist at https://packagist.org/
After logging in, click submit to display the page
Fill in your own github project address here
After filling in, click check to check whether it has been used
If used, it will prompt
If not used, click submit
At this point, your own composer package has been submitted successfully, and anyone can install this project on their own github through the composer command.
4. Implement automatic updates on Packagist
When we update the code to github, we also need to manually click update to update the latest code to Packahist. We can add service hooks to let Packagist update automatically.
First click on settings
Then click on services, add services, search for packagist
The following interface appears
then fill in the information
The Token here is obtained from Packagist
After filling in, click add service to display
Then click edit to display
Click on the test service above, and the following prompt appears, indicating that it is normal
At this time, the code submitted on github will be automatically pushed to Packagist without manual update. Install the project with composer and it will be up to date.