Home Development Tools composer Create composer.json

Create composer.json

Aug 10, 2019 pm 02:08 PM
composer

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!

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

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
1 months ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
1 months ago By 尊渡假赌尊渡假赌尊渡假赌
Will R.E.P.O. Have Crossplay?
1 months ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Solve CSS prefix problem using Composer: Practice of padaliyajay/php-autoprefixer library Solve CSS prefix problem using Composer: Practice of padaliyajay/php-autoprefixer library Apr 17, 2025 pm 11:27 PM

I'm having a tricky problem when developing a front-end project: I need to manually add a browser prefix to the CSS properties to ensure compatibility. This is not only time consuming, but also error-prone. After some exploration, I discovered the padaliyajay/php-autoprefixer library, which easily solved my troubles with Composer.

How to use Composer to simplify PHP source code analysis: the application of theseer/tokenizer library How to use Composer to simplify PHP source code analysis: the application of theseer/tokenizer library Apr 18, 2025 am 06:00 AM

In the process of handling PHP source code analysis, I encountered a tricky problem: how to convert PHP code into a format that is easier to analyze and process. I tried multiple methods, but none of them worked well. Finally, by installing the theseer/tokenizer library using Composer, I successfully converted the PHP source code to XML format, greatly simplifying subsequent analysis work.

How to simplify string conversion of PHP values: Application of coduo/php-to-string library How to simplify string conversion of PHP values: Application of coduo/php-to-string library Apr 17, 2025 pm 11:30 PM

During development, I often need to convert various data types in PHP into strings for logging, debugging, or data processing. However, handling different types of conversions often seems cumbersome and error-prone. Until I discovered the library coduo/php-to-string, which allowed me to easily convert any PHP value into strings, greatly simplifying my workflow.

How to easily manage collection data using Composer: Application of ramsey/collection library How to easily manage collection data using Composer: Application of ramsey/collection library Apr 17, 2025 pm 11:39 PM

In project development, I encountered a common but difficult problem: how to efficiently manage and manipulate collection data. I have tried multiple methods, but I always feel that it is not flexible and efficient enough when dealing with complex data structures. Later, I discovered the ramsey/collection library, which completely changed my development experience.

How to simplify performance monitoring in PHP projects using Composer How to simplify performance monitoring in PHP projects using Composer Apr 17, 2025 pm 11:57 PM

When developing PHP projects, we often need to monitor the execution time of the code to optimize performance. In one of my recent projects, I encountered a problem: I needed to do precise timing between different code segments, but manually implementing the timer is not only tedious, but also error-prone. After some exploration, I discovered the library phpunit/php-timer, which is easily integrated through Composer, greatly simplifying my work.

Solve database connection problem: a practical case of using minii/db library Solve database connection problem: a practical case of using minii/db library Apr 18, 2025 am 07:09 AM

I encountered a tricky problem when developing a small application: the need to quickly integrate a lightweight database operation library. After trying multiple libraries, I found that they either have too much functionality or are not very compatible. Eventually, I found minii/db, a simplified version based on Yii2 that solved my problem perfectly.

Practical experience in creating efficient command line interfaces using the Symfony/Console library Practical experience in creating efficient command line interfaces using the Symfony/Console library Apr 18, 2025 am 07:30 AM

In project development, it is often necessary to create command-line tools to simplify daily tasks or automate processes. However, creating a command line interface that is beautiful and easy to test is not easy. Recently, I encountered this problem while developing a project that requires command line tools. After some exploration, I found the Symfony/Console library, which greatly simplifies the creation process of command line interfaces.

How to quickly build LaravelCMS with Composer: mki-labs/espresso practical experience How to quickly build LaravelCMS with Composer: mki-labs/espresso practical experience Apr 18, 2025 am 07:36 AM

I encountered a tricky problem when developing a new Laravel project: how to quickly build a fully functional and easy-to-manage content management system (CMS). I tried multiple solutions, but all gave up because of complex configuration and inconvenient maintenance. Until I discovered the LaravelCMS package mki-labs/espresso, which not only simple to install, but also provides powerful functions and intuitive management interface, which completely solved my problem.

See all articles