Home>Article>Development Tools> Create composer.json

Create composer.json

藏色散人
藏色散人 forward
2019-08-10 14:08:09 5500browse

The following columncomposer usage tutorialwill share with you how to create composer.json. I hope it will be helpful to friends in need!

Create composer.json

Create composer.json

We can create the json file manually or automatically. If there is automatic, of course automatic is preferred

Run the command line composer init in our project root directory and it will be automatically created

PS D:\code\test3> composer init Welcome to the Composer config generator This command will guide you through creating your composer.json config. Package name (/) [kelle/test3]: my/ctest Description []: Author [, n to skip]: dragonfly429  Minimum Stability []: Package Type (e.g. library, project, metapackage, composer-plugin) []: License []: Define your dependencies. Would you like to define your dependencies (require) interactively [yes]? Search for a package: Would you like to define your dev dependencies (require-dev) interactively [yes]? Search for a package: { "name": "my/ctest", "authors": [ { "name": "dragonfly429", "email": "dragonfly429@foxmail.com" } ], "require": {} } Do you confirm generation [yes]?

You need to know the fields and format of this json file

--name: 包的名称。 --description: 包的描述。 --author: 包的作者。 --homepage: 包的主页。 --require: 需要依赖的其它包,必须要有一个版本约束。并且应该遵循 foo/bar:1.0.0 这样的格式。 --require-dev: 开发版的依赖包,内容格式与 --require 相同。 --stability (-s): minimum-stability 字段的值。

name author require is required The

-dev represents the syntax used during development, which is the same as npm (save does not need to be written)

The above is the detailed content of Create composer.json. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:juejin.im. If there is any infringement, please contact admin@php.cn delete