Home > Development Tools > composer > Create composer.json

Create composer.json

藏色散人
Release: 2019-09-02 13:57:22
forward
5755 people have browsed it

The following column composer usage tutorial will 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 (<vendor>/<name>) [kelle/test3]: my/ctest
Description []:
Author [, n to skip]: dragonfly429 <dragonfly429@foxmail.com>
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]?
Copy after login

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  字段的值。
Copy after login

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!

Related labels:
source:juejin.im
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template