PHPComposer Installation and Use

Source: Internet
Author: User
Tags autoloader
Composer is a tool used in PHP to manage dependencies. You can declare the dependent external library (libraries) in your project. Composer will help you install these dependent library files. PHPComposer system installation requirements: Composer requires PHP5.3.2 + and above to run. There are several sensitive PHP settings

Composer is a tool used in PHP to manage dependencies. You can declare the dependent external library (libraries) in your project. Composer will help you install these dependent library files. PHP Composer system installation requirements: Composer requires PHP5.3.2 + and above to run. There are several sensitive PHP settings

Composer YesPHPIs used to manage dependency relationships. You can declare the dependent external tool library in your project (Libraries),ComposerWill help you install these dependent library files.

Install PHP Composer

System Requirements:

Composer needs PHP5.3.2 + and above to run. Several sensitive PHP settings and compilation flags are also required, but the installer issues a warning when there is any incompatibility.

For example, PHP extension requires that php without-disable-phar be installed or re-compiled.

To install a software package from the source address, instead of simply compressing the file package, you will need to install the software package's version control tools, such as git, svn, or hg.

Composer is compatible with multiple platforms and runs on Windows, Linux, and OSX.

Error message of installation failure:

Curl-sS https://getcomposer.org/installer | PHP
#! /Usr/bin/env php
Some settings on your machine make Composer unable to work properly.
Make sure that you fix the issues listed below and run this script again:

The phar extension is missing.
Install it or recompile php without-disable-phar

Your PHP (5.2.9) is too old, you must upgrade to PHP 5.3.2 or higher.

My local development environment is PHP 5.2.9 by default. When I try to install it on PHP 5.2.9, the system prompts that the version is too low and needs to be upgraded to PHP 5.3.2 or later.

So I downloaded XAMPP 1.7.7 usb lite.

E: \ USB \ Dropbox \ phpstorm \ php53> E: \ USB \ xampp_177 \ php \ php.exe-v
PHP 5.3.8 (cli) (built: Aug 23 2011 11:50:20)
Copyright (c) 1997-2011 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2011 Zend Technologies

The PHP environment in XAMPP 1.7.7 is 5.3.8. Confirm that my PHP environment is greater than or equal to PHP5.3.2.

Install Composer in PHP 5.3

E: \ USB \ Dropbox \ phpstorm> curl-sS https://getcomposer.org/installer | E: \ USB \ xampp_177 \ php \ php.exe
#! /Usr/bin/env php
Some settings on your machine may cause stability issues with Composer.
If you encounter issues, try to change the following:

The openssl extension is missing, which will reduce the security and stability o
F Composer.
If possible you shoshould enable it or recompile php with-openssl

Downloading...

Composer successfully installed to: E: \ USB \ Dropbox \ phpstorm \ php53 \ composer. phar
Use it: php composer. phar

Note:

  • I disabled the SSL module of XAMPP 1.7.7 Apache, so Composer prompts me to warn me that I should enable the SSL module for security reasons. It is not enabled or affected.
  • Parameter during installation | PHP, which must be changed to the actual PHP environment path, for example, | E: \ USB \ xampp_177 \ php \ php.exe
  • Use Composer as the PHP path + command. In our installation environment, use the E: \ USB \ xampp_177 \ php/php.exe composer. phar command.
  • The environment I installed is in Windows. If it is in Linux and the PHP 5.3 environment is not in the default PHP Command, |/usr/php/53/usr/bin/php should be used, for example:

Https://getcomposer.org/installer |/usr/php/53/usr/bin/php

After the installation is complete, check the installation version.

E: \ USB \ Dropbox \ phpstorm \ php53> E: \ USB \ xampp_177 \ php/php.exe composer. phar-V
Composer version 0209bd31a0ac3aeb2a68fc81e2d03c71072bef33

Check the PHP Composer command:

E: \ USB \ Dropbox \ phpstorm \ php53> E: \ USB \ xampp_177 \ php/php.exe composer. phar
______
/____/_______________________________
///__\/__'__\/__\/__\/___/_\/___/
//___//_////////_///_/(__)__//
\____/\____/_//_//_/.___/\____/____/\___/_/
/_/
Composer version 0209bd31a0ac3aeb2a68fc81e2d03c71072bef33

Usage:
[Options] command [arguments]

Options:
-Help-h Display this help message.
-Quiet-q Do not output any message.
-Verbose-v Increase verbosity of messages.
-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
.

Available commands:
About Short information about Composer
Archive Create an archive of this composer package
Config Set config options
Create-project Create new project from a package into given directory.
Depends Shows which packages depend on the given package
Diagnose Diagnoses the system to identify common errors.
Dump-autoload Dumps the autoloader
Dumpautoload Dumps the autoloader
Help Displays help for a command
Init Creates a basic composer. json file in current directory.
Install INSTALLThe project dependencies from the composer. lock file
If present, or falls back on the composer. json.
List Lists commands
Require Adds required packages to your composer. json and INSTALLThe
M
Run-script Run the scripts defined in composer. json.
Search Search for packages
Self-update Updates composer. phar to the latest version.
Selfupdate Updates composer. phar to the latest version.
Show Show information about packages
Status Show a list of locally modified packages
Update Updates your dependencies to the latest version according
Composer. json, and updates the composer. lock file.
Validate Validates a composer. json

In this way, we have installed the Composer in the PHP5.3 environment.

You can install PHP 5.4 in a similar way.

(...)
Read the rest of PHP Composer Installation and Use (580 words)

©Lixiphp for LixiPHP, 2013. | Permalink | No comment | Add to del. icio. us
Post tags: Composer, PHP, PHP 5.3, PHP 5.4, Symfony, XAMPP, dependency management tools

Feed enhanced by Better Feed from Ozh

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.