composer-php 在Ubuntu上安装Composer


本文向大家介绍composer-php 在Ubuntu上安装Composer,包括了composer-php 在Ubuntu上安装Composer的使用技巧和注意事项,需要的朋友参考一下

示例

在下载和安装Composer之前,我们需要确保服务器已安装所有依赖项。

首先,通过运行以下命令更新程序包管理器缓存:

sudo apt-get update

现在,让我们安装依赖项。我们将需要curl下载Composer并php5-cli进行安装和运行。git由Composer用于下载项目依赖项。可以使用以下命令安装所有内容:

sudo apt-get install curl php5-cli git

现在让我们安装它:

curl -sS https://getcomposer.org/installer | sudo php -- --install-dir=/usr/local/bin --filename=composer

这将在/ usr / local / bin下作为名为composer的系统级命令下载并安装Composer。输出应如下所示:

Output
#!/usr/bin/env php
All settings correct for using Composer
Downloading...

Composer successfully installed to: /usr/local/bin/composer
Use it: php /usr/local/bin/composer

要测试您的安装,请运行:

composer

并且您应该获得类似于以下的输出:

Output
   ______
  / ____/___  ____ ___  ____  ____  ________  _____
 / /   / __ \/ __ `__ \/ __ \/ __ \/ ___/ _ \/ ___/
/ /___/ /_/ / / / / / / /_/ / /_/ (__  )  __/ /
\____/\____/_/ /_/ /_/ .___/\____/____/\___/_/
                    /_/
Composer version 1.0-dev (9859859f1082d94e546aa75746867df127aa0d9e) 2015-08-17 14:57:00

Usage:
 command [options] [arguments]

Options:
 --help (-h)           Display this help message
 --quiet (-q)          Do not output any message
 --verbose (-v|vv|vvv) Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug
 --version (-V)        Display this application version
 --ansi                Force ANSI output
 --no-ansi             Disable ANSI output
 --no-interaction (-n) Do not ask any interactive question
 --profile             Display timing and memory usage information
 --working-dir (-d)    If specified, use the given directory as working directory.

....