Last Updated: February 25, 2016
·
4.82K
· nekwebdev

Give Laravel 4 a kick start!

For a fast and easy install of Laravel 4 I highly suggest this tip. It is a bash script that will git laravel 4 and do some house working for you. I did a little variation on it, but all credit goes back to Neil Sweeney. Anyways, here it is as I figure it could be of some use to some:

#!/bin/bash
# Install Laravel 4 and configure
# Call scriptname.sh projectname
# The projectname parameter will be the name of the folder where laravel 4 will be installed.
# 
# This script assumes that your webroot is in ~/www/
# 
# Check the path for your commands. It is better to use full paths in scripts.
# 
# Read the code once and make sure everything is the same on your system!

echo "Installing Laravel 4 into $HOME/www/$1/"

cd $HOME/www/

echo "Downloading master branch."

/usr/bin/git clone https://github.com/laravel/laravel.git $1

cd $1

echo "Checking out dev branch."

# Required for getting Laravel4 dev
/usr/bin/git reset --hard HEAD
/usr/bin/git checkout develop

# Make the app/storage directory writable
chmod -R 777 app/storage

# Check if composer is installed globally, if not install it locally.
if hash composer 2>/dev/null; then
    echo "Composer is installed globally."
    /usr/local/bin/composer install
else
    echo "Installing Composer into $HOME/www/$1/"
    /usr/bin/curl -s https://getcomposer.org/installer | php
    composer.phar install
fi

echo "Generating application key."

php artisan key:generate

echo "Cleaning up the git."

rm -rf .git

echo "Laravel 4 installed in $HOME/www/$1/"

exit 0

I usually run this script right after to configure my Apache2 virtual host.

I highly suggest you all checkout andrew13/Laravel4-Bootstrap-Starter-Site on Github. It is a base Laravel 4 install with come nice Composer packages built in. The Confide + Entrust authentication/roles combo is very nice and fits my needs. Plus the base demo is a GREAT learning source to understand the bases of the framework and the templating system.

I want to start learning Laravel 4 and am close to a complete noob with php MVC frameworks. I had a quick look at CodeIgniter about a year ago, but now Laravel 4 really caught my attention. And for what little I got to work on it already, I find it very elegant and pleasing to work with!

I have very high hopes for the project I plan to code and will document the interesting parts of it here.

I know this is not a blog per say, but I will try to retrace all the steps I took in a structured way so that each tip works on it's own out of the whole build my website log :)

I will try to keep the tips short and on a single topic, technique, or resource.