Elegant to use composer to install various PHP gadgets

Source: Internet
Author: User
Tags pear composer install

The impact of composer on the PHP world is enormous, and the use of composer to replace Pear must be a trend. When the small partners are still immersed in the composer brought convenience, have you ever thought how to better use composer, online most of the direct download composer and then directly in the current directory to run the method is not a little sense of the cock wire it. Yes, it's a good tool to put in/usr/bin, but I prefer another way.

The first is the usual download Composer.phar to whatever directory. Like, like, home.

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

(This is the *nix installation method, please click here for the Windows platform)

Composer has a global command that can be used to install some common PHP commands such as composer, phpunit, etc. into the ~/.composer/vendor/ directory, similar to the way pear.

Then let's install some common PHP tools, including composer yourself can be installed with composer!

$ ./composer.phar global require ‘composer/composer:dev-master‘$ ./composer.phar global require ‘phpunit/phpunit:3.7.*‘$ ./composer.phar global require ‘fabpot/php-cs-fixer:dev-master‘

Install it later to delete Composer.phar, ~/.composer/vendor/bin add to your PATH variables, restart the terminal, you can use these PHP tool commands anywhere, and because all the information exists in ~/.composer/composer.json the directory, what tools are installed there are all at a glance, Mother does not have to worry about the examination of what documents arrived /usr/bin . All the composer global installed tools are in ~/.composer/vendor , want to kill want to cut free, the big deal all deleted a re- composer install click! Also don't need sudo every time to upgrade these PHP gadgets.

Elegant to use composer to install various PHP gadgets

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.