1.github 建立項目 ,項目名稱:yii2_mailerqueuephp
2.製做並上傳包git
a.首先clone yii2_mailerqueue 項目github
$ git clone https://github.com/luopeihai/yii2_mailerqueue.git
b.打開yii2_mailerqueue文件,把開發測試完成的源碼文件夾 src 複製黏貼到yii2_mailerqueue根目錄下redis
c.建立composer.json文件json
{ "name": "freelances/mailerqueue", "description": "Yii 2 send mail by redis", "keywords": ["yii2", "redis", "mail"], "homepage": "http://www.yiiframework.com/", "type": "yii2-extension", "license": "BSD-3-Clause", "support": { "issues": "https://github.com/luopeihai/yii2_mailerqueue/issues", "forum": "", "source": "https://github.com/luopeihai/yii2_mailerqueue" }, "authors" : [ { "name" : "lph", "email" : "459114230@qq.com" } ], "require": { "yiisoft/yii2": "*", "yiisoft/yii2-redis": "~2.0.0" }, "autoload" : { "psr-4" : { "freelances\\mailerqueue\\" : "src/" } } }
git 提交代碼api
3.登陸 https://packagist.org 綁定 git項目yii2
a.https://packagist.org登陸 並點擊 submit按鈕app
b. Repository URL (Git/Svn/Hg) 輸入框中輸入 https://github.com/luopeihai/yii2_mailerqueue.git(項目git地址) 並提交composer
c.爲了 每次git提交 代碼,packagist會自動更新,須要 GitHub Service Hookyii
首先打開cmd
$ curl -XPOST -H'content-type:application/json' 'https://packagist.org/api/update-package?username=luopeihai&apiToken=用戶token' -d'{"repository":{"url":"https://github.com/luopeihai/yii2_mailerqueue.git"}}'
其中 apiToken 在packagelist 我的信息 profile中獲取
4.打包發佈版本
打開cmd,提交版本
$ cd yii2_mailerqueue yii2_mailerqueue $ git tag -a v0.1.0 -m 'first version' yii2_mailerqueue $ git push origin --tags Counting objects: 1, done. Writing objects: 100% (1/1), 157 bytes | 0 bytes/s, done. Total 1 (delta 0), reused 0 (delta 0) To https://github.com/luopeihai/yii2_mailerqueue.git * [new tag] v0.1.0 -> v0.1.0
提交成功後 經過github 對應項目 releases查看
5.驗證
使用國內composer源剛發佈版本須要等待一段時間:因爲"牆"的緣由,不少開發者並無用composer 官方的源,而是經過國內第三方源,這樣能提升下載速度,可是對於咱們直接發佈在官網的包,可能須要等一段時間,國內第三方源同步了纔有.
若是是用官方源的無需等待即可測試
$ php composer.phar require freelancers/mailerqueue