Last Updated: February 25, 2016
· nekwebdev

Laravel 4 Bootstrap Site basic setup

Hello world!

I will go into details on the first steps I took to have a solid base for the Laravel 4 framework.

Check out andrew13/Laravel-4-Bootstrap-Starter-Site!

I was really happy when I googled this up ^^

I had been looking at a ton of tutorials on Laravel 4 and was about to start coding my way through an auth system, with roles, permissions a user admin management and a blog/products/bananas/item manager.

In this case this starter bootstrap for Laravel 4 has it all!

Check out my previous tip where I posted a bash script to auto install Laravel 4, here si the same script modified for Laravel 4 Bootstrap Site:

# Install laravel 4 bootstrap site and configure
# Call 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 -e "\e[1;34mInstalling Laravel 4 Bootstrap Site into \e[1;31m$HOME/www/$1/\e[0m"

cd $HOME/www/

echo -e "\e[1;34mDownloading master branch from \e[1;34mgit://\e[0m"

/usr/bin/git clone git:// $1

cd $1

echo -e "\e[1;34mSetting permissions to \e[1;31m$HOME/www/$1/app/storage\e[0m"

# 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 -e "\e[1;34mComposer is installed globally.\e[0m"
    /usr/local/bin/composer install
    echo -e "\e[1;34mInstalling Composer into \e[1;31m$HOME/www/$1/\e[0m"
    /usr/bin/curl -s | php
    composer.phar install

echo -e "\e[1;34mGenerating application key.\e[0m"

php artisan key:generate

echo -e "\e[1;34mCleaning up the git.\e[0m"

rm -rf .git*

echo -e "\e[1;34mLaravel 4 Bootstrap Site installed in \e[1;31m$HOME/www/$1/\e[0m"

exit 0

Now you need to go and edit your app/config/database.php file, but it would be wiser to first setup environments and local config files.

First open up bootstrap/strat.php

And make your $env look like so:

$env = $app->detectEnvironment(array(

    'local' => array('*.local', 'VirtualMint'),

    'production' => array('*.com'),


VirtualMint is my hostname, hit hostname in terminal to know yours. This allows for artisan to know that it needs to look in the local configuration files on the local machine, so you don't have to type php artisan --env=local everytime.

Now create two new folders in your app/config folder: local and production

Copy the default database.php and mail.php to those folders, if you start changing things to app.php also copy it there before any changes and do the changes in the ones in the right folder, local or production.

Edit app/local/ database.php and mail.php to your local server settings and maybe use a gmail for mail.php. That is what I am trying we'll see if it works for local dev :)

Next it is time to migrate and seed your databases:

php artisan migrate
php artisan db:seed

You also need to make sure your application encryption key is set (php artisan key:generate) and that your app/storage folder is writable by the server (chmod -R 775 app/storage or 777 if that does not work).

The script I posted does both already and chmod -R 777 to be sure it works. No worries on doing that on a local host. I would make sure chmod -R 755 works on your production server as otherwise it would mean permissions are not set right.

Fire up your browser and your skeleton site should be up and running!

Go to /admin to checkout the admin panel.

This is all very straightforward but I am sure it could help someone out and I am selfishly doing it as a way of tracking my progress ^^

8 Responses
Add your response

Hiya - did you get Gmail working for local :-) ?

Also I went through and everything seemed fine but I get a "ErrorException
mkdir(): Permission denied" when browsing to the install ... any help much appreciated (using Ubuntu and have set storage to 777)

over 1 year ago ·

Heya :) well I did try it, but it somehow got my newly created gmail blocked :p

So I just decided not to bother with it and setup my web apps to use postmarkapp, which works really nice for when you need to have a real transactional email go off during development.

Btw, checkout the branch I made of this project, quite a few changes which might get merged, who knows. I learned a lot by going through this code project and changing it. I think I will now start my own app skeleton ^^

over 1 year ago ·

Hey thanks - I'll check it out... still can't get it working though :-) An "ErrorException mkdir(): Permission denied"... any help much appreciated (using Ubuntu and have set storage to 777)..

over 1 year ago ·

This could be a problem with basset not being able to write its compiled assets. Try
chmod -R 777 public/assets/compiled
Check your basset config file in app/config/packages/jasonlewis/basset to make sure assets/compiled is also where your assets are built

over 1 year ago ·

Perfect - that solved it, thanks a lot ...

over 1 year ago ·

Er - Nek - you don't need any work do you by any chance? :-)

over 1 year ago ·

A small spelling mistake... it should be: "bootstrap/start.php".

over 1 year ago ·

Why in the world you use chmod 777 ??? This is a very bad practice. Folders does 'nt need to execute applications. So chmod 600 for files and a fopdwe is chmod 700 oke.
Wrong user?
chown -R www-data storage/ ;)

over 1 year ago ·