Laravel 6 Tutorial
Laravel is a PHP MVC framework. A framework is a collection of integrated libraries that work together to achieve a common goal. A framework forms the foundation on which programmers develop applications on. MVC stands for Model-View-Control. It is a design pattern that separates the data, business logic and presentation. Models deal with business logic and data, Views are responsible for presentation while the Controllers glue the Models and Views together.
The latest version of Laravel as of this writing is version 6. These tutorial series assume you are new to Laravel but familiar with PHP programming in general. For experienced developers, these tutorial series will help refresh your mind on first principles.
Topics to be covered
- Why Laravel framework's popularity matters
- Features of Laravel MVC framework
- How Laravel works
- What we will cover in these tutorial series
- Tutorial Project Larashop
Does it matter if Laravel is the most popular framework according to the SitePoint survey?
Yes, it does matter. From a career perspective, the logical implication of this is that there are more Laravel developer jobs compared to other frameworks. This doesn't mean you should discard other frameworks. It means learning Laravel MVC framework gives you more opportunities to find jobs/ personal projects to work on.
Features of Laravel MVC framework that make it superb!
The following are some of the features that make Laravel MVC framework very popular among developers.
- Built on already time-tested components
- Supports Rapid Application Developing (RAD) -- the artisan command line utility can be used to create boiler plate code for controllers and models. The command line utility can also be used to perform other tasks such as running unit tests, migrations etc.
- Uses namespaces unlike other frameworks such as CodeIgniter.
- Blade template -- this is a built-in template engine
- Built in features for common web application tasks such as authentication, routing, database managing, sending emails etc.
- Class auto loading -- this means you do not have to manually load the classes
- RESTful controllers -- this allows you to take advantage of HTTP verbs such as GET, POST, PUT, and DELETE etc.
- Unit Testing -- built in unit testing features that can be run from the artisan command line.
- Support for composer - Laravel uses composer. Composer is a package management system for PHP. This means you can use packages from www.packagist.com in your Laravel projects
- Eloquent ORM -- Eloquent is an Object Relational Mapper framework that implements PHP Active Record.
- Excellent developer community -- Laravel has good documentation and free tutorials on the internet that all come in handy when learning Laravel. StackOverflow also has a good number of answered questions for Laravel. This means you can easily find solutions to most of the challenges that you will face when developing applications.
How Laravel works
Laravel is a PHP MVC framework. A framework is a collection of libraries that perform specific tasks and work together to accomplish a common goal. MVC stands for Model-View-Controller. It is a design pattern that allows developers to separate business logic (Model) from presentation (View) glued together by the controller. Instead of us writing PHP code to coordinate all of these activities, Laravel has that functionality baked in out of the box. In addition to that, it has libraries (also know as packages) that provide database support, formatting responses sent back to the user, parsing input from the users and so many things.
In a nutshell, Laravel works by providing a singe entry into the application via
index.php file and then using the defined routes direct the request to the relevant controller. The controller in turn communicates with the model if necessary, then loads the view and sends back the results to the user. If its an Application Programming Interface (API) then the output is usually via JSON format. Other formats such as XML are supported as well using the relevant packages.
The official website for Laravel is //laravel.com/. You can download Laravel from the official website. You can also find helpful information on how to get started with Laravel and how to use most of the components in Laravel.
What we will cover in these tutorial series
We will cover the following concepts in these tutorial series.
01. Laravel Installation and Configuration - This tutorial gives you step by step instructions on how to download, install and configure Laravel to get started.
02. Laravel Hello World - This tutorials takes you through the basics of how Laravel application work by creating a simple easy to follow hello world application.
03. Laravel Artisan Console - This tutorial introduces you to Laravel Artisan Console too. Artisan allows you to automate various tasks when working with Laravel framework.
04. Laravel Routing - this tutorial shows you how to create SEO friendly routes in Laravel and match them to controllers.
05. Laravel Controllers - This tutorial takes the beginner into the basics of Laravel controllers, how to create controller using artisan and make them work with routes.
06. Laravel Migrations - This tutorial introduces you to database migrations in Laravel on how to get started creating the database and how to maintain it using migrations.
07. Laravel Models - This tutorial introduces you to database models in Laravel. We will look at how to interact with the database and define model relationships.
08. Laravel Faker - this tutorial introduces you to the command line utility artisan that every Laravel developer should know to be successful and productive as a "Laravel Developer".
09. Laravel Blade Template - This tutorials introduces you to views in Laravel and how you can work with the built-in templating engine called Blade template.
10. Laravel Forms - This tutorial shows you how to create and process forms in Laravel. We will also look at how to store the results in the database.
11. Laravel Validation -This tutorial introduces you to validation in Laravel, we will look at how to perform validation using built-in rules as while as how to create custom validation rules.
12. Laravel Email - email is almost indispensable to the internet. This tutorial shows you how you can send emails directly from your web application.
13. Laravel Authentication - This tutorial shows you how to authenticate users in Laravel and grant access to protected pages. We will look at both automatic and manual authenticating.
14. Laravel REST API - This tutorial shows you how to create RESTful APIs in Laravel, the best practices to follow and how you can authenticate API requests for protected endpoints.
15. Laravel Shopping Cart - This tutorial shows you how to install and configure a shopping cart in Laravel. We will also look at how to add, update and remove items from the shopping cart.
Tutorial Project Larashop
The best way to learn and test your skills is to develop a real-world project. Larashop is a tutorial project that we will create. It is basically an online store that allows you to browse through products and add them to a shopping cart. The application is simple and basic but it does bring together all the pieces of knowledge that we cover in the individual lessons.
The following images shows the application that we will build
The checkout page will be as follows
In this tutorial, we introduced you to the theoretical definition of what an MVC framework is and how Laravel fits into that description and how it works. We looked at some of the features of Laravel framework and the topics that we will cover in the tutorial series.
Sign up for a free account to track your learning progress by clicking on the register for a free account button below. You can use the comments section below to let us know what you think about the tutorial.