composer
composer
学习开发自己的 Composer 包,并使用 GitHub 实时更新到 Packagist
创建目录名称
mkdir try-make-package
cd try-make-package
初始化扩展包
☁ composer init
Welcome to the Composer config generator
This command will guide you through creating your composer.json config.
Package name (<vendor>/<name>) [lingan/try-make-package]:
Description []: try make a package
Author [saboran <saboran@163.com>, n to skip]:
Minimum Stability []: dev
Package Type (e.g. library, project, metapackage, composer-plugin) []: library
License []: MIT
Define your dependencies.
Would you like to define your dependencies (require) interactively [yes]? n
Would you like to define your dev dependencies (require-dev) interactively [yes]? n
{
"name": "lingan/try-make-package",
"description": "try make a package",
"type": "library",
"license": "MIT",
"authors": [
{
"name": "saboran",
"email": "saboran@163.com"
}
],
"minimum-stability": "dev",
"require": {}
}
Do you confirm generation [yes]? yes
创建类文件
把自己的代码放到src目录
增加.gitignore
为 git 忽略一些文件,增加 readme.md 为项目增加描述
.idea
vendor/
composer.lock
提交代码到 github
先在自己的 Github 主页上创建一个新的仓库然后将项目提交到对应仓库,参考如下
git init
git add -A
git commit -am "init && dev package"
git remote add origin git@github.com:bill/try-make-package.git
git push -u origin master
本文是原创文章,采用 CC BY-NC-ND 4.0 协议,完整转载请注明来自 程序员小航
评论
匿名评论
隐私政策
你无需删除空行,直接评论以获取最佳展示效果