GitHub創建倉庫
創建倉庫,下載到本地 git clone https://github.com/example.git
Composer.json 文件編輯
初始化 文件 composer init
{
"name": "your-vendor-name/package-name", // 你的名字,注意要格式不能有空格之類的,主要在composer 時候使用 ,對應 composer require topsoap/php-soap 中的topsoap 就是這里的名字 / 對應 php-soap
"description": "A short description of what your package does", // 擴展簡介
"require": {
"php": "^7.2", //必須的版本
},
"authors": [ // 作者聯系地址
{
"name": "name",
"email": "name@163.com"
}
],
"license": "MIT", // 主要解決在上傳到Packagist后網站出現There is no license information available for the latest version (dev-master)警告
}
編輯之后,使用git tag v1.0
和git push origin v1.0
將代碼打上標簽,Packagist 網站會檢測到版本號,此處省略多次了git操作
發布 Packagist
在Packagist網站上注冊自己賬號或者直接使用GitHub賬號,在導航欄點擊提交,填寫GitHub倉庫鏈接

Packagist網站 package自動更新
在上傳成功后出現This package is not auto-updated. Please set up the GitHub Hook for Packagis
解決方案是在當前的GitHub的倉庫的設置中URL鏈接認證,https://packagist.org/api/bitbucket?username=buleknight&apiToken=API_TOKEN
,API_TOKEN在Packagist 網站的個人中心
GitHub的倉庫

API_TOKEN在Packagist 網站的個人中心
