生成composer.json文件
我们可以简单使用composer init 创建项目的composer.json 文件,
之后会以问答的形式提示你填写信息, 以下 ">" 后 表示交互时输入的信息 > composer init
Welcome to the Composer config generator
This command will guide you through creating your composer.json config.
Package name (/) [composertest/example]: # 厂商名与包名
> suntianxiang/cn-oauth
Description []: > A library for wechat,alipay,weibo OAuth2 Client # 详细信息
Author [stx <334965556@qq.com>, n to skip]:
Minimum Stability []: > beta # 下载时倾向开发版还是稳定版
Package Type (e.g. library, project, metapackage, composer-plugin) []:
> library # 包的类型,我们属于library,固填library
License []: MIT # 开源协议
Would you like to define your dependencies (require) interactively [yes]? > no # 是否需要定义你的依赖
Would you like to define your dev dependencies (require-dev) interactively [yes]? > no
{
"name": "suntianxiang/cn-oauth",
"description": "A library for wechat,alipay,weibo OAuth2 Client",
"type": "library",
"require-dev": {
"phpunit/phpunit": "^6.5"
},
"license": "MIT",
"authors": [
{
"name": "stx",
"email": "334965556@qq.com"
}
],
"minimum-stability": "beta",
"require": {
"php": "> 7.0",
"guzzlehttp/guzzle": "^6.3"
},
"autoload": {
"psr-4": {
"CnOAuth\\": "src"
}
}
}
最后会输出生成的composer.json文件 ()