Getting Started With Laravel for Beginners: the Best FREE Quickstart Tutorials

Laravel is the Most Starred PHP Framework on Github: more than 30 000 developers from all over the world (mostly from the USA) use it for custom software development. Thinking about Laravel 5 but don’t know where to start? Among the features that make Laravel framework better than others there are awesome documentation, community and step-by-step tutorials. In this post, to save your time, we've gathered expert advices on how to download, install and configure your first Laravel-based project.
Sep 19, 2018


#1 Installing Laravel Homestead Virtual Machine

Use Laravel Homestead (pre-packaged Vagrant box) as your development environment. Vagrant is the command line utility for building and maintaining portable virtual development environments.

Laravel Homestead runs on any Windows, Mac, or Linux system, and includes the Nginx web server, PHP 7.0, MySQL, Postgres, Redis, Memcached and a variety of other useful utilities. With Laravel Homestead it is not required to separately install PHP, a web server, and any other server software on your local machine.

#2 Installing Laravel from Composer

Laravel framework consists of many separate components that are downloaded and put together automatically into a framework through a special tool called “Composer” (a tool for dependency management in PHP). So, before using Laravel, make sure you have Composer installed on your machine.

#3 Using Artisan command-line interface in Laravel

Artisan is the command-line interface included with Laravel.  Artisan offers many useful commands that can help you perform various tasks, such as generating migrations or publishing a package's assets. In addition to the built-in commands, you can extend Artisan with your own commands.

Artisan comes with Laravel by default. If your php command works fine, then the only thing you need to do is to navigate to the project's root folder. The root folder is the parent folder of the app folder.

#4 Creating Routes and Loading Views WITHOUT Controllers in Laravel

The "hello world" for frameworks is to figure out how to process a given URI, and display the appropriate HTML on the page.

Routes define the endpoints of a web application, the final destinations of incoming requests. All Laravel routes are defined in the route files, which are located in the routes directory. These files are automatically loaded by the framework. For most applications, you will begin by defining routes in your routes/web.php file.

Views are used to build up the resulting page that the user will see in their browser when they click on a link or submit a form. Typically a view is the HTML response returned by the application to the browser initiating the request.  Views can be loaded directly from the routing file.  Views are stored in the resources/views directory. View files have a .php file extension or a .blade.php file extension if you use the Blade templating engine.

Using route closures (defining all of your request handling logic as closures in route files, without controllers) is very useful for small projects that don't require too much functionality. Closure based routes cannot be cached. To use route caching, you must convert any closure routes to controller classes.

#5 Creating Routes and Loading Views WITH Controllers in Laravel

For most projects you may wish to organize request handling logic using controllers. Controllers are PHP classes that contain application’s logic and are called from the application’s routing files. Controllers contain methods called “actions” that direct the execution flow of a web application by working with application’s data (models), producing output (views) or redirecting. Controllers can group related request handling logic into a single class. The controllers need to be connected to the routing mechanisms in order to be executed when the application runs. Controllers are stored in the app/Http/Controllers directory.

By creating a controller and specifying which routes in the routing file use its member functions you are able to take full advantage of MVC pattern in your Laravel applications.

Another important advantage of using controllers with routes instead of putting all code into the “route.php” file is that using separate PHP classes to build application’s functionality brings the full benefits of Object Oriented Programming (OOP) such as dependency injection, encapsulation, inheritance and more. This aspect of application architecture is incredibly important for developers who practice good design patterns in their applications.

If your application is using controller based routes, you should take advantage of Laravel's route cache. Using the route cache will drastically decrease the amount of time it takes to register all of your application's routes. In some cases, your route registration may even be up to 100x faster.

#6 Using Blade templating language to create templates in Laravel

Laravel uses its own view template engine called “Blade”. Blade template engine is fantastic for reducing or simplifying the code that you write in your view. Blade template engine also allows you to easily create layouts, extend them and include partials to prevent you from repeating the same HTML in multiple files. Using Blade makes it is possible to combine many templates (for example, header.blade.php, footer.blade.php and sidebar.blade.php) into a single HTML output. To reduce duplication, Blade provides "layout files." Within these files, you can define the wrapping HTML, which nests the content from each of your views.

Blade Template Engine

#7  Adding/managing your CSS and JS files in Laravel

When it comes to including your assets (CSS and JavaScript files), you can create directories within your public folder and add it directly in your view file. This is great for small projects.

Blade Template Engine

But if you need to use CSS preprocessors, or concatenate some files and minify them, Laravel Elixir (a tool to integrate Gulp into your Laravel projects, a task runner built as a wrapper around Gulp) will help you.

Gulp is a well-known JavaScript-based task runner - an automated tool for performing repetitive tasks like concatenation, minification, unit testing, linting etc. With Gulp you can create tasks to watch, compile, concatenate, minify and auto-prefix your CSS and Sass/Less, concatenate and minify JS, minify HTML and optimise images.

Elixir is built on top of Gulp, so to run your Laravel Elixir tasks you only need to run the gulp command in your terminal. Make sure that you install Gulp globally first.

#8 Database Management and Database Operations in Laravel

Currently, Laravel supports four database systems: MySQL, Postgres, SQLite, SQL Server. The database configuration for your application is located at config/database.php. In this file you may define all of your database connections, as well as specify which connection should be used by default.

Laravel interprets the data stored in the database into objects that you can easily manipulate like you would manipulate any other PHP object. This allows the developer to focus on other parts of the application instead of figuring out complex Structured Query Language (SQL) queries necessary to work with the data.

Laravel comes with two powerful sets of features to execute database operations, by using its own Query Builder or by using concept of “models” in Eloquent ORM. You can use both in the same application (even combine both to get the most flexibility out of DB operations).

Laravel’s Query Builder provides a clean and simple interface for executing database queries. It is a powerful tool that can be used for various database operations such as retrieving records, inserting new records, deleting records, updating records, performing “Join” queries, executing raw SQL queries, filtering, grouping and sorting of records

Laravel makes interacting with databases extremely simple using the Eloquent ORM (the most preferred way to fetch data and render it in the view). The Eloquent ORM provides an ActiveRecord implementation to work with your database. This means that each model corresponds to a table in your database. We can use Eloquent to interact with our database and do the basic CRUD functions, set up and use one-to-one relationships, one-to-many relationships, AND many-to-many relationships.

Some of the advanced database operations that Laravel provides out of the box are managing database tables and fields through special files called “migrations”, populating database with sample data (also called “seeding”), working with separate read/write databases, pagination, many different relationship types and advanced methods of querying relations, database transactions and query logging.

#8.1 Laravel CRUD operations

Forms exist in just about every single web application. How does it work in Laravel? Let's review the basic workflow for submitting a form, fetching the data that was sent through, and then creating a record in the database.

You'll of course need to modify existing records in the database. Let's review the process of creating an "edit" page to handle this very task. Along the way, we'll also get a chance to review PATCH requests and the concept of eager loading and the problems it solves.

Along the way, you'll be introduced to custom packages, service providers, and much more.

#8.2 Validation in Laravel

Laravel provides several different approaches to validate your application's incoming data. Let's look at a complete example of validating a form and displaying the error messages back to the user.

#8.3 Authentication and Authorisation in Laravel

Most applications will require some form of authentication. With Laravel, it is simple. Let's setup registration, authentication, and password resets in minutes.

#9 Using Laravel Middleware

Middleware provide a convenient mechanism for filtering HTTP requests entering your application. There are many more cases where you would like to use a middleware: changing the site language based on locale, enabling site-wide maintenance, sniffing bot traffic, logging etc. There are several middleware included in the Laravel framework, including middleware for authentication and CSRF protection. All of these middleware are located in the app/Http/Middleware directory. Additional middleware can be written.

#10 Laravel Flash Messages Example

Often, you'll want to send a quick notification to the user when they perform some kind of action in your application. "Good job, your task has been created." Or: "You are now logged out." So it seems that we need a way to store things in the session for just a single request. There are some clean ways to handle this in Laravel!

#11 Laravel Service Container

Laravel's service container (also known as the IoC container) is the heart of Laravel. It is a powerful tool for managing class dependencies and performing dependency injection.

Basically the IoC Container is just an ordinary PHP class. But we can place or “Bind” in it everything we need from interfaces implementations to directories paths and so on. Now, since we have a single Object that contains all of our various bindings, it is very easy to retrieve them back or “resolve” them at any point in our code.

#12 Laravel Service Providers

Service providers are the central place of all Laravel application bootstrapping. Your own application, as well as all of Laravel's core services, are bootstrapped via service providers.
But, what do we mean by "bootstrapped"? In general, we mean registering things, including registering service container bindings, event listeners, middleware, and even routes. Service providers are the central place to configure your application. For example, when installing a package, you have to give application access to that package - one of the best solutions is through Service Providers list and a Facade.

Laravel ships with many facades which provide access to almost all of Laravel's features. In a Laravel application, a facade is a class that provides access to an object from the container.

Facades have many benefits. They provide a terse, memorable syntax that allows you to use Laravel's features without remembering long class names that must be injected or configured manually. Furthermore, because of their unique usage of PHP's dynamic methods, they are easy to test. However, some care must be taken when using facades.

Laravel Starter Kits

Videos are obviously useful without a doubt. However, many will agree that nothing compares to a working example of a functional code.

Laravel Community

Laravel Community are free discussion forums for asking and answering questions about using Laravel framework.

Twitter accounts to Follow

Taylor Otwell, Dayle Rees, Shawn McCool, Jeffrey Way, Chris Fidao, Phil Sturgeon, Jens Segers, Ben Corlett, Matt Stauffer, Graham Campbell, Belitsoft

Do you need to read some pdf books about Laravel?

New to PHP?

Blog writers

Subscribe to Belitsoft's Blog for Entrepreneurs

Join successful software startup founders! Get insights from growing companies like, where to get an idea, how to validate it, how to launch, and how to hire people - everything. Enter your email address below (no spam):

Email *


This is it. You have a big idea that will disrupt education and propel you to the top of the eLearning industry. Now you just need to... do what exactly? A good first step would be to read this article and learn the steps to launching your own learning software.

Our team is experienced both in PHP programming and Node.js development. We have a portfolio with both PHP-based applications and Node.js-based applications as well as mixed ones. What do we take into account when considering which tool to use in custom software development? ...

Laravel framework is very popular for custom software development. It is the Most Starred PHP Framework on Github: more than 35 000 developers from all over the world (mostly from the USA) greatly appreciate robust features of this platform. Based on data of the BuiltWith, Laravel's popular websites verticals include Business, Entertainment, Media, News, Shopping, Technology, Vehicles. Why is Laravel so popular? ...

Laravel is the Most Starred PHP Framework on Github: more than 30 000 developers from all over the world (mostly from the USA) use it for custom software development. Thinking about Laravel 5 but don’t know where to start? Among the features that make Laravel framework better than others there are awesome documentation, community and step-by-step tutorials. In this post, to save your time, we've gathered expert advices on how to download, install and configure your first Laravel-based project ...

Belitsoft has a huge experience in MVP software development for startups and prototypes for existing brands. MVP is a minimal version of the product with the minimum set of features that is enough to deploy and test the key hypothesis to solve problems of this product’ potential customers. Experts suggest that, in B2B, it’s not an MVP until you sell it. Viable means you can sell it. ...

The way to get profitable startup idea is not to try to think of startup ideas (including SaaS development). It's to look for problems, preferably problems you have yourself.  In fact, for many entrepreneurs, successful business ideas start out as solutions designed to address a challenge they face personally. Solving the problem that frustrates you may be one of the best ways of finding an idea for your startup. Look at these software developers who turned their problem into success.  ...

Get A Free Quote

Do you have a software development project to implement? We have people to work on it.
We will be glad to answer all your questions as well as estimate any project of yours.
Use the form below to describe the project and we will get in touch with you within 1 business day.

Call us:
Phone - USA
Contact form