Home  >  Article  >  Backend Development  >  How to install and use PHP Composer on Debian

How to install and use PHP Composer on Debian

不言
不言Original
2019-04-09 10:09:243672browse

php composer is a package management tool that eliminates the hassle of manually maintaining your application's PHP packages. All required packages can be easily installed using composer. This article will introduce how to install and configure PHP Composer on Debian systems.

How to install and use PHP Composer on Debian

1. Conditions

shell uses sudo permissions to access the running debian system.

PHP version 5.3 or higher must be installed and configured.

2. Install Composer on Debian

You can download the composer script from the getcomposer.org website by running the following command. It will create a composer.phar file in the current directory.

$ curl -sS https://getcomposer.org/installer | php

Copy the composer.phar file in the bin directory so that it can be used anywhere in the system. Also, set execution permissions on the file. Change the file name from composer.phar to composer for ease of use.

$ mv composer.phar /usr/local/bin/composer
$ chmod +x /usr/local/bin/composer

Enter composer at the command prompt. This will give you details of the Composer version and the options available in the Composer command.

$ composer 

   ______
  / ____/___  ____ ___  ____  ____  ________  _____
 / /   / __ \/ __ `__ \/ __ \/ __ \/ ___/ _ \/ ___/
/ /___/ /_/ / / / / / / /_/ / /_/ (__  )  __/ /
\____/\____/_/ /_/ /_/ .___/\____/____/\___/_/
                    /_/
Composer version 1.6.3 2018-01-31 16:28:17

Usage:
  command [options] [arguments]

Options:
  -h, --help                     Display this help message
  -q, --quiet                    Do not output any message
  -V, --version                  Display this application version
      --ansi                     Force ANSI output
      --no-ansi                  Disable ANSI output
  -n, --no-interaction           Do not ask any interactive question

3. Upgrade php composer

composer can upgrade itself without re-downloading. Just run the following command from terminal to upgrade compose on debian.

$ sudo composer self-update

This article has ended here. For more exciting content, you can pay attention to the PHP Video Tutorial column on the PHP Chinese website!

The above is the detailed content of How to install and use PHP Composer on Debian. For more information, please follow other related articles on the PHP Chinese website!

Statement:
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