Home > Development Tools > composer > A brief tutorial on Composer

A brief tutorial on Composer

藏色散人
Release: 2019-09-11 14:01:40
forward
3451 people have browsed it

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" %*
Copy after login

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
Copy after login

Linux system/Mac OSX system

Operate under the terminal command line.

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

# cd ~
Copy after login

Download the composer.phar file

# wget https://getcomposer.org/composer.phar
Copy after login

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

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

Set execution permissions, you must have execution permissions

# chmod 755 /usr/local/bin/composer
Copy after login

Test it

# composer -V
Copy after login

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!

Related labels:
source:segmentfault.com
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