創(chuàng)建一個空的代碼庫
composer init
初始本地代碼,根據(jù)提示完成操作:
1.This command will guide you through creating your composer.json config.` Package name (/) :
填寫包名(git地址中)
2.Description []:
包的描述信息
3.Author
作者信息
4.Minimum Stability []:
提示填寫最小穩(wěn)定版本,可輸入內(nèi)容為:stable, RC, beta, alpha, dev,穩(wěn)定性依次從左到右從大到小,越左邊越穩(wěn)定bug越少,自己測試的包就輸入:dev
5.Package Type (e.g. library, project, metapackage, composer-plugin)[]: library
提示填寫項目類型
6.License[]:MIT
提示填寫開源許可證
7.Would you like to define your dependencies (require) interactively [yes]?
提示是否需要設置依賴環(huán)境或者其他包
8.Search for a package:
提示搜索哪個依賴?依賴PHP,輸入php
9.Enter the version constraint to require (or leave blank to use the latest version):
需要哪個版本?
10.Add PSR-4 autoload mapping? laps namespace "Koala9527\Composerbuild"to the entered relative path. [src/, n to skip]:
是否添加PSR-4自動加載映射,
11.Do you confirm generation[yes]?
確認生成 yes
12.Would you like to install dependencies now [yes]?
是否先擇安裝依賴,
完成初始
composer dump-autoload 命令 自動加載類映射 生成配置
#打上標簽并加注釋
git tag -a "v1.0.1" -m "my first composer package"
#push標簽到遠程代碼倉庫,之后GitHub上就可以看到當前tag了
git push origin v1.0.1