Skip to content

Instantly share code, notes, and snippets.

@wpsmith
Forked from davebarnwell/PHP composer tools.md
Created February 27, 2019 23:55
Show Gist options
  • Select an option

  • Save wpsmith/f36c18141e4140bf6fc7e9eec63c6e3b to your computer and use it in GitHub Desktop.

Select an option

Save wpsmith/f36c18141e4140bf6fc7e9eec63c6e3b to your computer and use it in GitHub Desktop.

Revisions

  1. @davebarnwell davebarnwell revised this gist Oct 18, 2016. 1 changed file with 2 additions and 0 deletions.
    2 changes: 2 additions & 0 deletions PHP composer tools.md
    Original file line number Diff line number Diff line change
    @@ -1,3 +1,5 @@
    # Global installation of PHP tools with Composer

    To install a composer package globally, you run the usual require command, but with the addition of the global modifier. So to install PHPUnit, you would run:

    ```bash
  2. @davebarnwell davebarnwell created this gist Oct 18, 2016.
    28 changes: 28 additions & 0 deletions PHP composer tools.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,28 @@
    To install a composer package globally, you run the usual require command, but with the addition of the global modifier. So to install PHPUnit, you would run:

    ```bash
    $ composer global require phpunit/phpunit
    $ composer global require phpunit/dbunit
    $ composer global require phing/phing
    $ composer global require phpdocumentor/phpdocumentor
    $ composer global require sebastian/phpcpd
    $ composer global require phploc/phploc
    $ composer global require phpmd/phpmd
    $ composer global require squizlabs/php_codesniffer
    ```
    This will install PHPUnit and all its dependencies into the ~/.composer/vendor/ directory and, most importantly, the phpunit CLI tools are installed into ~/.composer/vendor/bin/.

    Simply add this directory to your PATH in your ~/.bash_profile (or ~/.bashrc) like this:

    ```bash
    export PATH=~/.composer/vendor/bin:$PATH
    ```

    and phpunit is now available on your command line.

    To keep your tools up to date, you simply do this:

    ```bash
    composer global update
    ```
    To remove a package, you edit ~/.composer/composer.json and then run composer global update.