Skip to content

Instantly share code, notes, and snippets.

@gilsondev
Last active January 1, 2016 06:39
Show Gist options
  • Save gilsondev/8106816 to your computer and use it in GitHub Desktop.
Save gilsondev/8106816 to your computer and use it in GitHub Desktop.
Script created to facilitate the creation of a project laravel using composer.
#!/bin/bash
# File: laravel_project.sh
# Description: Script created to facilitate the creation of a project laravel using composer.
#
# Use: ./laravel_project <project name>
#
green='\e[0;32m' # '\e[1;32m' is too bright for white bg.
endColor='\e[0m'
# If command not exists, install
if ! foobar_loc="$(type -p "composer")" || [ -z "$foobar_loc" ]; then
echo -e "${green}Installing composer... \n${endColor}"
php -r "eval('?>'.file_get_contents('https://getcomposer.org/installer'));"
echo -e "${green}Moving composer command in /usr/local/bin... \n${endColor}"
sudo -k mv composer.phar /usr/local/bin/composer
echo -e "${green}Composer command created. Now, creating the project... \n${endColor}"
fi
# Create project
composer create-project laravel/laravel $1 --prefer-dist
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment