search
HomeDevelopment ToolscomposerA brief tutorial on Composer

A brief tutorial on Composer

Sep 11, 2019 pm 02:01 PM
composer

A brief tutorial on Composer

Composer usage tutorial-Concise tutorial

Composer is a PHP Dependency management tools.

To use and install Composer, please make sure that PHP (version 5.3.2) has been installed correctly and the PHP environment variable is set (the one that can display the php version number using the command php -v).

Composer installation

Windows system

Installation directory.

For example, if installed under D:\Program Files\Composer, this directory will be used to set Composer's environment variables.

Download the composer.phar file to the installation directory.

Download the latest version: https://getcomposer.org/compo...

Download list page of each version: https://getcomposer.org/download

Installation Create an executable file named composer.bat in the directory and fill in the following line in the file:

@php "%~dp0composer.phar" %*

Set Composer environment variables

Right-click on the computer desktop "Computer" -> Menu "Properties" -> "Advanced System Settings" -> "Environment Variables" at the bottom -> Find the Path item in "System Variables", edit it, and add the Composer installation directory path to the variable value at the end Characters, such as;D:\Program Files\Composer (this is written according to your installation directory). Remember to use English semicolons; to separate multiple paths.

Test it (use DOS command window)

composer -V

Linux system/Mac OSX system

Operate under the terminal command line.

Enter the temporary download folder (anything, such as your home directory)

# cd ~

Download the composer.phar file

# wget https://getcomposer.org/composer.phar

Move and rename the composer.phar file to the binary directory

# mv composer.phar /usr/local/bin/composer 相当于设置Composer环境变量了

Set execution permissions, you must have execution permissions

# chmod 755 /usr/local/bin/composer

Test it

# composer -V

Using Composer

List Some commonly used ones.

composer self-update: Update composer version. (Of course, you can also download the composer.phar file to overwrite and update).

composer install: Install dependent code libraries based on the composer.json file in the current directory.

composer update: Update dependent code base.

composer create-project: Create a project.

composer init: Interactively create the composer.json file in the current directory.

Composer’s resources

Composer official website (English) https://getcomposer.org

PHP installation package list (English) https:// packagist.org

Composer Chinese website (Chinese) http://www.phpcomposer.com

Packagist/Composer China Full Mirror (Chinese) http://pkg.phpcomposer.com

Welcome corrections

Original link on GitHub

https://github.com/wuyumin/tutorial/blob/master/zh-cn/Composer/README.md

You are welcome to star this project on GitHub or provide correction suggestions through Issues.

The above is the detailed content of A brief tutorial on Composer. For more information, please follow other related articles on the PHP Chinese website!

Statement
This article is reproduced at:segmentfault. If there is any infringement, please contact admin@php.cn delete
Composer Credentials: What Makes Someone a Composer?Composer Credentials: What Makes Someone a Composer?Apr 14, 2025 am 12:13 AM

The key elements of becoming a composer include: 1. Mastering music theory, 2. Being creative and original, 3. Having technical skills, 4. Being able to express emotions and tell stories, 5. Understand cultural and historical background, 6. Accumulating practice and experience, these elements together constitute the composer's identity and ability.

The Path to Becoming a Composer: A Practical GuideThe Path to Becoming a Composer: A Practical GuideApr 13, 2025 am 12:11 AM

The steps to becoming a composer include: 1. Master the basic elements of music, such as notes, rhythm, harmony, and melody; 2. Select appropriate technical tools, such as AbletonLive; 3. Understand the process of composing, including inspiration acquisition, conception, writing, modification and improvement; 4. Start with simple melody creation and gradually try complex techniques such as harmony; 5. Solve common problems through debugging techniques, such as note selection and rhythm arrangement; 6. Apply performance optimization and best practices, such as using templates, version control, and collaboration.

Composer: The Key to Building Robust PHP ApplicationsComposer: The Key to Building Robust PHP ApplicationsApr 12, 2025 am 12:05 AM

Composer is a key tool for building robust PHP applications because it simplifies dependency management, improves development efficiency and code quality. 1) Composer defines project dependencies through composer.json file and automatically downloads and manages these dependencies. 2) It generates a composer.lock file to ensure that the dependency version is consistent and automatically loaded through vendor/autoload.php. 3) Examples of usage include basic usage such as adding log libraries, as well as advanced usage such as version constraints and environment variable management. 4) Common error debugging techniques include handling dependency conflicts and network problems. 5) Performance optimization suggestions include using composer.lock file and optimizing automatic loading.

Composer Expertise: What Makes Someone SkilledComposer Expertise: What Makes Someone SkilledApr 11, 2025 pm 12:41 PM

To become proficient when using Composer, you need to master the following skills: 1. Proficient in using composer.json and composer.lock files, 2. Understand how Composer works, 3. Master Composer's command line tools, 4. Understand basic and advanced usage, 5. Familiar with common errors and debugging techniques, 6. Optimize usage and follow best practices.

What is a composer doing?What is a composer doing?Apr 08, 2025 am 12:19 AM

Composer is a dependency management tool for PHP, used to declare, download and manage project dependencies. 1) Declare dependencies through composer.json file, 2) Install dependencies using composerinstall command, 3) parse the dependency tree and download it from Packagist, 4) generate the autoload.php file to simplify automatic loading, 5) optimize use includes using composerupdate--prefer-dist and adjusting the autoload configuration.

What is App composer?What is App composer?Apr 07, 2025 am 12:07 AM

AppComposer is a tool for building and managing applications. 1) It simplifies application development and improves efficiency by dragging and configuring predefined components. 2) Developers can define components, combine interfaces, define business logic, and ultimately render the application. 3) Support basic and advanced usage, such as task management and conditional rendering, helping to build flexible applications.

What is a composer used for?What is a composer used for?Apr 06, 2025 am 12:02 AM

Composer is a dependency management tool for PHP. The core steps of using Composer include: 1) Declare dependencies in composer.json, such as "stripe/stripe-php":"^7.0"; 2) Run composerinstall to download and configure dependencies; 3) Manage versions and autoloads through composer.lock and autoload.php. Composer simplifies dependency management and improves project efficiency and maintainability.

What is Composer AI?What is Composer AI?Apr 05, 2025 am 12:13 AM

ComposerAI is an artificial intelligence-based tool for generating and optimizing code to improve development efficiency and quality. Its functions include: 1. Code generation: generate code snippets that meet the standards according to requirements. 2. Code optimization: By analyzing existing code, make optimization suggestions. 3. Automated testing: Generate test cases to ensure code quality.

See all articles

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)
3 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
3 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
WWE 2K25: How To Unlock Everything In MyRise
1 months agoBy尊渡假赌尊渡假赌尊渡假赌

Hot Tools

MantisBT

MantisBT

Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

Atom editor mac version download

Atom editor mac version download

The most popular open source editor

SublimeText3 Linux new version

SublimeText3 Linux new version

SublimeText3 Linux latest version

DVWA

DVWA

Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software

mPDF

mPDF

mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),