View on GitHub


Presentation notes from JMU Unix Users Group meetings

Laravel with Homestead : Web app Development and Management

PHP Docs

Laravel Docs

What is Homestead

Advantages of Homestead

Introduction to PHP and Laravel

An example of this can be seen here when we make controllers for websites:


class ForumsController < ApplicationController

  def index
    @forums = Forum.all




class FarmController extends Controller{
  public function index(){
    $farms = Farm::all();
    return view('farms.index', ['farms' => $farms]);


How to Setup and Install

vagrant box add laravel/homestead


git clone Homestead
ssh-keygen -t rsa -C “”


sudo nano /etc/hosts

Vagrant Global Aliases

# Some shortcuts for easier navigation & access
alias ..="cd ..";
alias vm="ssh vagrant@ -p 2222";

# Homestead shortcut
function homestead() {
  ( cd ~/Homestead && vagrant $* )

Creating Your First Project

Laravel File Structure

Application Structure

The important files created in the root are:

artisan: It is end point for artisan command which is used for various tasks and functions in Laravel.

composer.json: Dependency and all list for composer installation

.env: This file contain configuration based on the environment of the application.

package.json: This file contain node related dependency, for example compiling SASS or LESS.

Upon installing following directories will be created

App Directory

App Folder is one of major folder / directory in Laravel Framework, In Laravel Most of logics are written in App folder. This folder / directory contains below folders.

Bootstrap Directory

The bootstrap directory of Laravel contains files are used for bootstrapping and configuring Laravel Framework itself. This directory is also contains a cache directory which holds all framework generated files for performance optimization and

Config Directory

This directory contains all configration related files of laravel Framework. This directory consist of below files

Database Directory

Laravel’s Database Directory is used to kept your database migrations and seeds. If you are going to use SQLLITE Dtabase, then you can also use this directory to hold and SQLLITE DB.

Public Directory

The public directory of laravel consist of a file named index.php. In Laravel this file is an entry point for your application .This directory also holds your public assets like images , js , css files.

Resources Directory

Laravel’s Resources directory contains all view files of your application. This directory also hold your language files

Routes Directory

The routes directory of laravel contains all of the routes of your applications. web.php, api.php, console.php and channels.php are default routes files that are included in Laravel 5.4

Storage Directory

The storage directory of laravel contains all of your coompiled blade files,sessions files, file caches, and other files generated by the framework.

The storage/app/public is available for storing user-generated files, such as profile image,product images etc

Tests Directory

The tests directory contains all of your automated tests

Vendor Directory

The vendor directory contains Composer dependencies related files of your application.

Example App in Browser

laravel ap example