仓库地址:https://github.com/ngyhd/ngyhd
Packagist地址:https://packagist.org/packages/ngyhd/ngyhd#dev-master
- github创建仓库
git init
- 创建src文件夹并在目录下添加代码
- 添加composer.json文件
{
"name": "ngyhd/ngyhd",
"type": "yii2-extension",
"description": "The Async mailer for the Yii framework",
"keywords": ["yii2", "redis", "async", "mailer"],
"license": "MIT",
"support": {
},
"authors": [
{
"name": "ngyhd",
"email": "xxx@qq.com"
}
],
"require": {
"yiisoft/yii2": "*",
"yiisoft/yii2-redis": "~2.0.0"
},
"autoload": {
"psr-4": {
"ngyhd\\ngyhd\\": "src/"
}
}
}
- 提交到仓库
git commit
git push origin
- 把github仓库地址submit check 到 Packagist
- 设置自动更新packgist
地址 : https://packagist.org/about#how-to-update-packages
在本地执行命令
curl -XPOST -H’content-type:application/json’ ‘https://packagist.org/api/update-package?username=ngyhd&apiToken=API_TOKEN’ -d’{“repository”:{“url”:“PACKAGIST_PACKAGE_URL”}}’
获取API_TOKEN和PACKAGIST_PACKAGE_URL
- 打包成版本
git tag –a v0.1.0 –m ‘init code’
git push origin –tags