转载

创建自己的composer包

一 在github上创建一个项目

二  修改项目的composer.json文件

在composer.json文件添加必要信息,例如:

{     "name": "muyuren/nuf",     "description": "nuf framework",     "keywords": [         "nuf"     ],     "homepage": "http://www.36nu.com/",     "license": "MIT",     "authors": [  {      "name": "muyuren",      "email": "ning@36nu.com"  }     ],     "require":{  "noahbuscher/macaw": "dev-master",  "illuminate/database": "*",  "filp/whoops": "*"     },     "autoload":{  "classmap":[      "app/controllers",      "app/models",      "assists"  ]     } }

三 在https://packagist.org/上提交自己的包

在官网注册账号,然后submit自己的包,在提交页面的文本框中输入你在github上的项目地址,packagist会自动检测是否合法。如果合法点击递交即可

四 设置github的hook

版本控制工具大多支持hook,用于代码递交时触发一个事件,将代码同步到其他环境中。在github上设置hook后,每次push都会自动同步到packagist上,这样就不需要手动同步了,方法如下:

Go to your GitHub repository Click the "Settings" button Click "Webhooks & Services" Add a "Packagist" service, and configure it with your API token, plus your Packagist username Check the "Active" box and submit the form

You can then hit the "Test Service" button to trigger it and check if Packagist removes the warning about the package not being auto-updated.

注:在https://packagist.org/profile/页面可以查看自己的API  token

原文  http://www.36nu.com/post/187.html
正文到此结束
Loading...