Skip to content

Instantly share code, notes, and snippets.

@lgrz
Created August 8, 2012 00:16
Show Gist options
  • Save lgrz/3290817 to your computer and use it in GitHub Desktop.
Save lgrz/3290817 to your computer and use it in GitHub Desktop.
Wrapper script for composer
#!/usr/bin/env sh
#
# A shell wrapper for composer.phar
#
#set -e
# Do we have PHP?
PHP=$(which php)
if [ -z "$PHP" ]; then
echo "Could not find PHP in your path..."
exit 1
fi
# Do you have composer? We're going to keep it in $HOME/bin
COMPOSER=$(which composer.phar)
if [ -z "$COMPOSER" ]; then
echo "Could not find composer in your path..."
echo ""
echo "Install composer:"
echo " cd $HOME/bin"
echo " curl -O http://getcomposer.org/composer.phar"
echo " chmod 755 composer.phar"
exit 1
fi
# https://github.com/composer/composer/issues/264
OPTS="-d apc.enable_cli=0"
# Work around --enable-zend-multibyte bug for phar files in PHP 5.3
$PHP -v | grep 'PHP 5.3' > /dev/null
if [ "$?" ]; then
$PHP $OPTS -d detect_unicode=Off $COMPOSER $*
else
$PHP $OPTS $COMPOSER $*
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment