创建一个空的代码库
composer init
初始本地代码,根据提示完成操作:
1.This command will guide you through creating your composer.json config.` Package name (/) :
填写包名(git地址中)
2.Description []:
包的描述信息
3.Author
作者信息
4.Minimum Stability []:
提示填写最小稳定版本,可输入内容为:stable, RC, beta, alpha, dev,稳定性依次从左到右从大到小,越左边越稳定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]?
提示是否需要设置依赖环境或者其他包
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