30 Second Introduction to Laravel 5

This tutorial will get you up and running with Laravel 5 under 30 seconds. I will cover Laravel 5 installation along with adding controllers and views to your project. This tutorial was made to be simple and straight forward. If you get lost at any step of the way the entire project source code can be found in my repo https://github.com/mbejda/30-second-Introduction-to-Laravel-5.
Lets get started.

Installing Laravel

Lets get the necessary Laravel 5 environment stuff out of the way :

Install Composer

curl -sS https://getcomposer.org/installer | sudo php -- --install-dir=/usr/local/bin --filename=composer

Install Laravel Installer.

composer global require "laravel/installer=~1.1"

Add Composer Vendors to Global Path.

echo "export PATH=$PATH:'~/.composer/vendor/bin'" > ~/.bash_profile

Create your first Laravel 5 project.

laravel new HelloWorld

Laravel 5 will automatically download and structure the project for you. Your directory structure should look similar to the following.

30 second introduction to laravel5

You may want to goto the Laravel 5 website to learn more about Laravel 5 root directory structure.

Creating A View

Navigate to resources/views and create a new view.
I called my view hello.php. Add the following html code to the view

<!DOCTYPE html>

        <link href="https://fonts.googleapis.com/css?family=Lato:100" rel="stylesheet" type="text/css">

            html, body {
                height: 100%;

            body {
                margin: 0;
                padding: 0;
                width: 100%;
                display: table;
                font-weight: 100;
                font-family: 'Lato';

            .container {
                text-align: center;
                display: table-cell;
                vertical-align: middle;

            .content {
                text-align: center;
                display: inline-block;

            .title {
                font-size: 96px;
        <div class="container">
            <div class="content">
                <div class="title">Laravel 5</div>

Creating A Controller

We need a controller to serve our new view. Navigate to app/Http/Controllers and create a new controller file. I named my controller file helloController.php. Then add the following php code to the file. If you want to learn more about how controllers work, I suggest taking a peek at the Larvel 5 documentation on controllers.


namespace App\Http\Controllers;

use App\Http\Controllers\Controller;

class helloController extends Controller

    public function hello()
        return view('hello');

Configure Routing

Routes glue controllers and views together. Lets configure a route to tell Laravel 5 we want our helloController to serve our hello view.

Navigate to /app/Http and open the routes.php file and add the following route code:

Route::get('/hello', 'helloController@hello');

Lets see our new view in action. Navigate to the root of the project and execute the following :

php artisan serve

Navigate to http://localhost:8000/hello and you should see something like this :

30 second introduction to laravel5