A starter Laravel app ready to go with asset management provided by Gulp.js, Twitter Bower using Bootstrap 3 and Font Awesome 4 with preconfigured Laravel Environments.
Neat: Pulls in Bootstrap, JQuery, Font Awesome and any other
bower
packages directly frombower_components
so you will always have the direct source when building from Gulp. No more copy/paste to update versions! At anytime runbower update
thengulp
and your compiledcss
andjs
will be refreshed with the latest versions of each package directly from thesrc
directories of each project. See the Gulpjs:vendor
andless:build
tasks ingulpfile.js
for more information.
- Clone this repo in your sites directory:
git clone https://github.com/jhauraw/laravel-bootstrap-bower-gulp.git
cd
into project directory
- Copy
env.template.php
and Rename to.env.php
(Note: preceeding "dot") - Edit file and change
app.env
fromdevelopment
toproduction
- Copy
env.template.php
and Rename to.env.development.php
(Note: preceeding "dot") - Later: for each "environment" you can set the other values as needed.
composer install
npm install
bower update
gulp
(Ignorejshint
warnings)php artisan serve
- In browser go to:
http://localhost:8000
- Edit
app/assets/less/app-styles.less
as needed - Run
gulp css:pub
to regenerate Less to CSS - Refresh in browser to see changes
- Edit
app/assets/js/app.js
as needed - Run
gulp js:pub
to regenerate JS - Refresh in browser to see changes
- Rinse & Repeat :-)
By default, you will be in production
environment. You probably want to be in development
when working locally. To switch:
php artisan key:generate
. Copy key toapp.key
in.env.php
and.env.development.php
- Set an ENV variable for
APP_ENV
todevelopment
. You can do this inphp-fpm.conf
,httpd.conf
, or your local shell ENV in.bash_profile
. - Edit settings in
.env.development.php
or which ever.env.*.php
you want to use
NOTE: For production
, be sure to change the "Acme" namespace in app/Acme
, app/config/auth.php
, and composer.json
, to your own, then run composer dumpautoload -o
While sensitive settings should go in the .env.*.php
files, site wide settings such as admin email address, phone number, and other global data typically go in a CONSTANTs file or Site Settings file. If you would like to use a similar setup, add as many entries as you need to the file app/config/setting.php
.
In your views
or any other Laravel file, your data will be available via Config::get('setting.key');
.
See the app/views/layouts/master.blade.php
file for implementaton example.
- Lessify css in
app-styles.less
npm install -g gulp
npm install --save-dev gulp gulp-less gulp-autoprefixer gulp-minify-css gulp-minify-html gulp-jshint gulp-concat gulp-uglify gulp-imagemin gulp-clean gulp-notify gulp-rename gulp-watch gulp-cache
-
app/
-
Created
- Directory
assets
and subdirsjs
,less
andimg
each with nested file.gitkeep
. Used to store sourcesrc
assets - Directory
build
and nested file.gitignore
. Used when building assets with build tool such as Gulp - Directory
Acme
. Used for application namespace and domain logic
- Directory
-
-
app/config/
-
Edited
- Any file needing secure/safe Environment specific settings. Added
getenv()
with key from.env.(*.?)php
environment file. Seeenv.template.php
for specifics auth.php
, changedmodel
key toAcme\User\User
cache.php
, changedprefix
key toel
- Any file needing secure/safe Environment specific settings. Added
-
Added
- Array key
options
todatabase.php
connections.mysql
array to support UTC tz in DB:'options' => [PDO::MYSQL_ATTR_INIT_COMMAND => 'SET time_zone = \'' . getenv('db.app.timezone') . '\''] )
- Array key
-
Created
- Directories
development
andstaging
each with nested file.gitkeep
. For Environment overriding - File
setting.php
. Stores app specific site settings/CONSTANTS
- Directories
-
-
app/start/global.php
-
Commented Out
ClassLoader::addDirectories
=>app_path().'/models',
-
Edited
Log::useFiles
name toapp.log
-
-
app/views/
-
Deleted
hello.php
-
Created
- Directories
layouts
, andhome
- Files
layouts/master.blade.php
, andhome/index.blade.php
- Directories
-
-
app/lang/en/
-
Created
- Files
header.php
,footer.php
, andnav.php
- Files
-
-
bootstrap/start.php
-
Edited
detectEnvironment
function to use SYSTEM/SERVER set valuegetenv('APP_ENV')
-
-
public/
-
Created
- Directory
assets
and subdirsjs
,css
,fonts
, andimg
each with nested file.gitkeep
. Used to store compiled/static assets
- Directory
-
Deleted
- File
.htaccess
. Using nginx server, not apache
- File
-
-
/
-
Created
- Files for environment config:
env.template.php
,.env.development.php
, and.env.php
- Files
.jscsrc
,.jshintrc
,bower.json
,gulpfile.js
,package.json
, andREADME.md
- Directories
bower_components
, andnode_modules
for use with build tool
- Files for environment config:
-
Edited
- File
.gitignore
removed ignore ofcomposer.lock
, added ignores of extra items specific to project
- File
-
-
composer.json
-
Edited
"name"
and"description"
"require.laravel/framework"
to latest version"4.2.*"
-
Added
"psr-4"
for own app namespace
-
Deleted
"app/models",
from"autoload.classmap"
-
Delete the following project specific files before committing or sharing your generated source on GitHub if creating a new public repo (but not for your own production as they are needed!):
/composer.lock
/bootstrap/compiled.php
/vendor
directory