在packagist上发布composer包
2017-12-27 本文已影响0人
小小聪耶
前提:
- 下载安装composer、git
- 注册packagist、github账号
一、在GitHub上发布代码
1、登录GitHub,点击new repository按钮

其中
Repository name: 仓库名称
Description(可选): 仓库描述介绍
Public, Private : 仓库权限(公开共享,私有或指定合作者)
Initialize this repository with a README: 添加一个README.md
gitignore: 不需要进行版本管理的仓库类型,对应生成文件.gitignore
license: 证书类型,对应生成文件LICENSE
2、拿到https地址去终端克隆

git clone https://github.com/xiaoxiaocong/phpTest.git
cd phpTest
将你需要的SDK文件内容都复制到phpTest文件夹中
git add .
git commit -m "提交信息"
git push -u origin master
此时你就可以在GitHub上看到自己提交的代码了,接下来我们需要利用compser来管理项目的依赖

然后打开composer.json,添加一些你需要的东西,并再次上传代码(add,commit,push)
其他参数可以参考此牛人文章Composer 的结构

二、发布到packagist
1、登录https://packagist.org,点击导航栏中的Submit按钮

然后你就发布自己的composer包了

想要设置包自动更新,请参考https://packagist.org/about#h...