PHP-发布一个composer包(稳定版本)

1、将项目push到github;并编写composer.json,如下:

{
  "name" : "ferrewagner/skepticism",
  "description" : "PHP micro Framework",
  "license":"MIT",
  "version":"1.0",
  "authors": [ { "name": "FerreWagner", "email": "[email protected]" } ],
  "require" : { "php" : ">=5.3.0", "filp/whoops" : "*", "symfony/var-dumper" : "*", "catfan/medoo":"*", "twig/twig":"~1.0", "phpoffice/phpexcel": "^1.8", "phpmailer/phpmailer": "^5.2" },
  "keywords" : [ "FerreWagner", "PHP Framework" ],
  "type" : "Framework" }

2、在https://packagist.org/上进行submit校验,并改进自己的composer.json依赖

3、在github项目的Settings的Integrations & services处添加包来源:

user和token填写你Packagist上的数据,在个人设置里。Domain可以不用填写;且一定要点击右上角的Test service;

4、在一切就绪后可立即composer到,但存在坑。
此时会提示:

Could not find package xxx/xxx at any version for your minimum-stability (stable). Check the package spelling or your minimum-stability.

即不存在稳定的版本。

即需要给自己的项目加上版本,在github的release处添加上版本。然后再本地git上为项目打上版本号:git tag -a v1.0
最后push到github。

5、在Packagist的包上update,更新版本。即可发布稳定的包。

你可能感兴趣的:(PHP开发,composer,Git/GitHub)