The following tutorial column from composer will introduce to you how to publish your own Composer package on Packagist. I hope it will be helpful to friends who need it!
Explanation of terms:
Brief description: I want to publish the project to packagist , you need to publish the project to github first (of course there is more than one option), and then log in to packagist to publish.
It can be understood that Packagist is the index and Github is the content provider
Steps:
1. Environment requirements (all official website downloads): git, composer, php,
2. Start packagist
Log in to https://packagist.org/ and click submit in the upper corner to submit the address of the git warehouse
Add the GitHub Service Hook domain to point to the address of packagist to achieve automatic updates (when github changes, packagist will update accordingly).
##The add packpackagist is as follows: User is the Packagist username and token is the ApiToken in Packagist. After the setting is completed, you can test whether it is successful 3. Use the expansion packcomposer require xxxx/xxx # 这时候会报错, Could not find package xxxx/xxx at any version for your minimum-stability (stable). Check the package。。。猜测是我的composer使用的国内镜像,可能是没有同步的原因,使用这个命令把“源”改回去还是不行。 composer config repo.packagist composer https://packagist.org # 继续猜测,原来我的组件还没有在github上发布正式,这个时候还是开发版本dev-master.应该加上dev-master版本。 composer require xxxx/xxx:dev-master # 成功
composer Column: https://www.php.cn/tool/composer/
The above is the detailed content of Publish your own Composer package on Packagist. For more information, please follow other related articles on the PHP Chinese website!