Laravel step by step guide for beginners

Dec 14, 2015

Milan Sanathara



Laravel step by step guide for beginners

Laravel is a PHP MVC framework for developing web applications. It is an open source framework released under MIT License. Laravel was developed out of the need to address most of the challenges in CodeIgniter MVC.

Laravel Framework is one of the best PHP frameworks for building solid maintainable code.When it comes to code reliability and maintainability, Laravel has a good foundation and great community support behind its PHP Framework.

Laravel step by step guide for beginners will teach you, how to install laravel on your machine and create your first page with laravel.

Top features of laravel

  • Laravel is enabled with numerous bundled features for easy addition to applications. It includes the modular packaging system which simplifies things for the programmers.
  • It helps to save a lot of time due to its instinctive modular packaging systems.
  • Set-up and customization process is incredibly easy.
  • Laravel comes with a lot of inbuilt features which aids in template engines, dependency injection containers, service layers and a well-built code.
  • It includes the restful controllers which offer an option for untying the logic behind attending HTTP GET and POST requests.

Let’s start with laravel, Create your first page in laravel.

How to install laravel in your machine?

To install laravel, you should be familiar with the composer.

A composer is a tool for dependency management in PHP. It allows you to declare the libraries your project depends on and it will manage (install/update) them for you.

First, check that the composer is already installed or not in your system. Here is how we are going to validate your composer installation.

Open a terminal and write composer and press enter.



If you will get the following result then, The composer is already installed on your machine.



If you don’t get the output shown in the image above. We need to identify two things. One whether or not you have a successful Composer installation. If you had a successful Composer installation you might not have an entry into the system environment variable.

I hope you are configuring Composer on Windows machine. Open your System Environment Variables. Go to the Path and hit edit. Add the following line: C:\Users\YOUR-USERNAME-HERE\AppData\Roaming\Composer\vendor\bin. I hope you kept the default installation directory on Composer installation. 

After following the above step, open CMD and hit the composer –version. You should receive the  Composer version information. That’s it! The setup was successful.

If you have a large scale web application project to be developed on Laravel. Contact us the Laravel Development Company for custom web application development.

Otherwise, download and install composer

After composer installation, Write following command in command line.

composer global require "laravel/installer=~1.1"

After above installation, create a directory in apache24 or xamp directory, then go to command line and set your created directory.

Then write the following command into a command line.

composer create-project laravel

where, laravel is the name of the project.

Now, create your first application.

Create a controller in /app/Http/Controllers/Alphansotech.php  and write following code in it.


namespace AppHttpControllers;

use IlluminateHttpRequest;

use AppHttpRequests;
use AppHttpControllersController;

class ALphansotech extends Controller
     * Display a listing of the resource.
     * @return Response
    public function index()


namespace AppHttpControllers : defines the namespace for our controller.
use IlluminateHttpRequest | use AppHttpRequests | use AppHttpControllersController : imports namespaces with the required classes to run the controller.
class Alphansotech extends Controller defines the class for the controller. The controller extends the base controller.
public function index(){ ….. } : defines the default function for the controller.

Now, navigate to app/Http/route.php and write following code.

    return 'Hello, This is AlphansoTech Laravel step by step guide.';

Now, open the following URL in the browser.


we can also call a view file from here, to call , we need to create a view file which renders the HTML output.

Laravel uses blade template :

Blade is a default template engine of laravel.It is simple yet it has all power tools you need.To read more about blade template ,click here.

Create a file resources/views/alphansotech.blade.php

<!DOCTYPE html>

        <link href="" 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">AlphansoTech Step By Step Laravel Guide</div>

Replace code in app/Http/route.php

Route::get('/alphansotech', function () {
    return view('alphansotech');


This is the basic Laravel step by step guide for beginners.To learn more about laravel, Kindly visit our blog regularly.

I hope you will find this post very useful regarding Laravel beginner guide . Let me know any questions if you have in comment regarding Laravel. I will reply you ASAP.

Have you got a cool idea about Web Application development? Contact us Now to get a free consultation on your idea. Alphanso Tech is rated as one of the best Web Development Company in India.


Post by Milan Sanathara

I am iOS Application Developer with an aspiration of learning new technology and creating a bright future in Information Technology.

2 Responses to Laravel step by step guide for beginners

  1. Pingback: slim tutorial | introduction and step by step tutorial guide

  2. Pingback: php restful api framework : slim tutorial | introduction and step by step tutorial guide

Leave a Reply

Your email address will not be published. Required fields are marked *