Skip to content

FrontendMatter/bs-layout-boilerplate-laravel

Repository files navigation

bs-layout-boilerplate-laravel

Laravel app boilerplate using Bootstrap Layout.

Demo

You can see a working live demo of this boilerplate running on Heroku.

Features

  • use the Laravel recommended gulp workflow with Laravel Elixir
  • import Sass files directly from node_modules using sass-importer-npm
  • leverage browserify module system to bundle external vendor scripts and app scripts into a single JavaScript file
  • customize colors
  • create layouts, pages and partials using Laravel Blade Templates
  • deploy a Laravel app using Docker containers
  • deploy a Laravel app using Heroku

Usage

Clone the boilerplate repository

git clone https://github.com/themekit/bs-layout-boilerplate-laravel.git my-project
cd my-project

Install dependencies

composer install && npm install

Build assets

gulp

Files of interest

The complete list of files modified or created in addition to the default Laravel installation.

├── Dockerfile
├── Procfile
├── app
│   └── Http
│       └── routes.php
├── composer.json
├── docker-compose.yml
├── gulpfile.js
├── heroku.nginx.conf
├── package.json
├── public
│   ├── css
│   │   ├── app.css
│   │   └── app.css.map
│   ├── js
│   │   ├── main.js
│   │   └── main.js.map
│   └── vendor
│       └── simplebar.css
└── resources
    ├── assets
    │   ├── js
    │   │   └── main.js
    │   └── sass
    │       ├── _variables.scss
    │       └── app.scss
    └── views
        ├── includes
        │   ├── content.blade.php
        │   └── head.blade.php
        ├── layouts
        │   ├── fixed.blade.php
        │   └── fluid.blade.php
        ├── sidebar.blade.php
        └── welcome.blade.php

Running the Laravel app on Heroku

First, get a free Heroku Account and download the Heroku Toolbelt. Then, login to Heroku:

heroku login

From the project root directory, create a Heroku app. Note that Heroku generates a random name for your app or you can pass parameter to specify your own app name.

heroku create

Configure the Heroku app to use the official PHP buildpack:

heroku buildpacks:set heroku/php

Deploy

When you created the app with heroku create, a git remote (called heroku) was also created and associated with your local git repository. To publish the application, you simply have to push to that remote:

git push heroku master

Ensure at least one instance of the application is running:

heroku ps:scale web=1

Visit http://<APP NAME>.herokuapp.com in your browser to see the Laravel app running.

--

Running the Laravel app with Docker

Docker runs any app, anywhere and allows you to package an application with all of its dependencies into a standardized unit for development and compose your application from microservices, without worrying about inconsistencies between development and production environments. Learn more about Docker

1. Setup docker

The easiest way to get started with docker is by using docker-machine and docker-compose. The rest of this guide assumes you already have both installed.

Create a docker machine

docker-machine create dev

Start the docker machine

docker-machine start dev

Setup environment

Point the local docker client to run commands against the dev docker machine:

eval "$(docker-machine env dev)"

2. Mounting the host directory

This step is required to be able to change the source code and see its effect on the application in real time in the running docker container.

docker-compose.yml

Update the volume path from docker-compose.yml:

For Linux:

volumes:
  - .:/app/www

For OS X:

volumes:
  - /Users/<YOUR USERNAME>/docker/<YOUR PROJECT NAME>:/app/www

If you are using Docker Machine on Mac or Windows, your Docker daemon has only limited access to your OS X or Windows filesystem. Docker Machine tries to auto-share your /Users (OS X) or C:\Users (Windows) directory.

For Windows:

volumes:
  - /c/Users/<YOUR USERNAME>/docker/<YOUR PROJECT NAME>:/app/www

3. Start docker container

From the root directory of this repository:

docker-compose up -d

4. Attach to the running container

The previous command should start a container i.e. myproject_web_1 but the name could be different. You can verify with docker ps. Assuming it's myproject_web_1:

docker exec -it myproject_web_1 bash

5. Open the Laravel app in your browser

After starting the container, to see the Laravel app running in your browser you only need to obtain the docker machine IP address and access http://DOCKER_MACHINE_IP. You can get the IP by running:

docker-machine ip dev

Laravel documentation

Documentation for the Laravel framework can be found on the Laravel website.


Get help

Get help directly from our team via our Slack channel. Request invite