Skip to content
This repository has been archived by the owner on Jan 31, 2021. It is now read-only.

remluben/laravel-boilerplate

Repository files navigation

NOTE: This project is archived and not updated anymore. Please simply use the latest version of Laravel, which contains an awesome list of frontend scaffolding.

Laravel Boilerplate

Introduction

The Laravel Boilerplate repository provides a simple Laravel 4 PHP framework setup including Bower and Grunt.

Requirements

Installation

  1. Download or git clone this repository
  2. Run
  • composer install
  • php artisan key:generate
  • bower install
  • npm install

For further information on Laravel setup ( database configuration, ... ) please take a look at http://laravel.com.

Usage

You can start developing immediately after installing the boilerplate.

  1. Run grunt develop on your command line
  2. Open http://your-url-to-laravel.local
  3. Modify some CSS or JS files located within your app/assets/ directory and watch the frontend change automatically due to livereload

How it works

Described in a nutshell, the approach of this laravel development setup is, that all resources ( *.css, *.js, *.less, ... ) from third party libraries as well as your own resources are stored within the restricted non-public app/ directory.

All files available or required within the web application are compiled, built or just copied to the public directory using tools such as Grunt.

This allows you as a developer, working on your source files without the need to care about modifying JavaScript or CSS file inclusions, when deploying your application.

An example

Let's assume you as a developer would like to add an additional library to work with. In order to show how easy you can do so, here's an example of how to integrate UnderscoreJS within your laravel project.

  1. Install the package and add it to the bower.json file:

bower install --save underscore

  1. Add the underscore.js source file to the target task within the Gruntfile.js configuration file:

     // JS file concatenation
     concat: {
         options: {
             separator: ';'
         },
         javascript: {
             src: [
                 './app/assets/components/bower/underscore/underscore.js',
                 './app/assets/components/bower/jquery/jquery.min.js',
                 './app/assets/components/bower/bootstrap/dist/js/bootstrap.min.js',
                 './app/assets/js/frontend.js'
             ],
             dest: './public/assets/js/frontend.js'
         },
     },
    
  2. Run the grunt develop task to start developing with the new package installed.

Thanks to

Special thanks to Elena Kolevska, who inspired me with her Laravel Grunt implementation and her excellent blog article.

And of course, I would like to thank all Laravel Framework developers, that made up this great framework.