Skip to content

Instantly share code, notes, and snippets.

@danmatthews
Last active August 29, 2015 14:17
Show Gist options
  • Save danmatthews/5533460b3287ba0995f2 to your computer and use it in GitHub Desktop.
Save danmatthews/5533460b3287ba0995f2 to your computer and use it in GitHub Desktop.
#! /usr/bin/env bash
# Change to your home dir.
cd ~/
if [ -a /usr/local/bin/composer ]; then
echo "You already have composer"
composerpath='composer'
else
# Get the composer.phar file.
curl -S http://getcomposer.org/installer | php
if [[ "$PATH" == *"/usr/local/bin"* ]]; then
# Move composer to a global folder in your $PATH;
sudo mv composer.phar /usr/local/bin/composer
composerpath='composer'
else
echo "Could not find global directory in path, using the local version to get stuff";
composerpath='php ~/composer.phar'
fi
fi
# Install testing components globally - this means you can run them from anywhere on your computer.
$composerpath global require behat/behat
$composerpath global require behat/mink
$composerpath global require behat/mink-goutte-driver
$composerpath global require behat/mink-selenium2-driver
$composerpath global require squizlabs/php_codesniffer
$composerpath global require squizlabs/mink-extension
$composerpath global require phpunit/phpunit
@danmatthews
Copy link
Author

Once you've done this, you need to add ~/.composer/vendor/bin to your $PATH. You can do that by adding:

export PATH='~/.composer/vendor/bin:$PATH'

to ~/.bash_profile or ~/.bashrc

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment