What is Laravel?
- Laravel is an open-source PHP framework.
- Laravel is the most popular PHP Framework.
- Uses a MVC design pattern.
- Intended for the development of web applications keeping things clean and organized.
- Relational database access.
- Laravel has a “syntactic sugar” orientation.
MVC (Model View Controller)
Model: The central component of the pattern. It is the application’s dynamic data structure, independent of the user interface. It directly manages the data, logic, and rules of the application.
View: Any Representation of information such as a chart, diagram or table. In other words, the user interface.
Controller: Accepts input and converts it to commands for the model or view.
Composer is PHP package manager.
It is used to install Laravel as well as packages used inside a laravel app.
$composer global require laravel/installer $laravel new webapp
- Artisan is Laravel’s command line interface.
- Create Controller, Model, View, Migration and more.
- Run migrations
- Run scheduled tasks
Eloquent ORM (Object Relational Mapper)
The way you interact with the database without writing complex SQL queries.
For Ex: Let’s say you have post table and you want to retrieve all post
If you want to apply the filter, need only active posts:
Blade syntax and templating
- Write once, use forever.
- Do not rewrite code every time you need a new page.
- Complied into plain PHP and cached.
- Views can extend layouts.