0% found this document useful (0 votes)
265 views20 pages

Welcome To My Presentation On: MD. Ashraful Alam ID: 181-15-1844

The document discusses Laravel, an open-source PHP web framework. It covers topics like what Laravel is, how to install it, its file structure, Artisan commands, routing, middleware, Blade templating, Eloquent ORM, and best practices.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
265 views20 pages

Welcome To My Presentation On: MD. Ashraful Alam ID: 181-15-1844

The document discusses Laravel, an open-source PHP web framework. It covers topics like what Laravel is, how to install it, its file structure, Artisan commands, routing, middleware, Blade templating, Eloquent ORM, and best practices.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 20

Welcome To My Presentation

On

MD. Ashraful Alam


ID: 181-15-1844
• WHAT IS LARAVEL
• INSTALL LARAVEL 5 WITH COMPOSER
• FILES STRUCTURE
• WHAT IS ARTISAN AND HOW DOES IT SAVE US
TIME
• ROUTING AND ROUTE TYPES
• WHAT IS MIDDLEWARE AND HOW TO USE IT
• WHAT IS BLADE ?
• DATABASE AND ELOQUENT ORM
• LARAVEL IS MVC PHP FRAMEWORK
CREATED BY TAYLOR OTWELL IN
•USES SYMFONY PACKAGES
•FREE
OPEN-SOURCE LICENSE WITH MANY
CONTRIBUTORS WORLDWIDE
ONE OF THE BEST FRAMEWORKS
TOGETHER WITH SYMFONY,  CODEIGNITER,
YII
HAS POWERFUL FEATURES, SAVING US TIME
• Eloquent ORM (object-relational mapping) – implements Active-
Record
• Query builder – helps you to build secured SQL queries
• Restful controllers – provides a way for separating the different HTTP
requests (GET, POST, DELETE, etc.)
• Blade template engine – combines templates with a data model to
produce views
• Migrations – version control system for database, update your database
easier
• Database seeding – provides a way to populate database tables with
test
data used for testing
• Pagination – easy to use advanced pagination functionalities

• Forms security – provides CSRF token middleware, protecting all the

forms
• Laravel uses Composer to manage its dependencies
• Composer is dependency management tool for PHP, like a library full of books
• NOT like Yum or apt

• Per project tool (vendor folder), not per system


• Install by using the command:
composer create-project [PACKAGE] [DESTINATION PATH] [--FLAGS]
composer create-project laravel/laravel Laravel test
app/Http folder contains the Controllers, Middlewares and Kernel file

All the models should be located in app/Models folder The service


providers that are bootstrapping functions in our app are located in
app/Providers folder

All the config files are located in app/config folder


• Database folder contains the migrations and Seeds

• The public folder is the actual folder you are opening on the web server.
All JS / CSS / Images / Uploads are located there.

• The resources folder contains all the translations, views and assets (SASS, LESS, JS) that are
compiled into public folder

• The routes folder contains all the routes for the project

• All the logs / cache files are located in storage folder

• The vendor folder contains all the composer packages (dependencies)


Artisan is command-line interface for Laravel
Commands that are saving time
Generating files with artisan is recommended
Run php artisan list in the console
• The best and easy routing system I’ve seen
• Routing per middleware / prefix or namespace
• Routing per request method (GET, POST, DELETE, etc.)
• ALWAYS name your route !
• Be careful with the routing order !
• The middleware is mechanism for filtering the
HTTP requests
• Laravel includes several middleware's –
Authentication, CSRF Protection
• The auth middleware checks if the user visiting the
page is authenticated through session cookie
• The CSRF token protection middleware protects
your application from cross-site request forgery
attacks by adding token key for each generated
form.
• Blade is the powerful template engine
provided by Laravel
• All the code inside blade file is compiled to
static html file
• Supports plain PHP
• Saves time
•Better components mobility, extend and
include partials.
ELOQUENT &
DATABASE
• THE ELOQUENT ORM (OBJECT-RELATIONAL MAPPING) PROVIDES SIMPLE ACTIVE
RECORD IMPLEMENTATION FOR WORKING WITH THE DATABASE

$article = new Article();


$article->title = ‘Article title’;
$article->description = ‘Description’;
$article->save();

INSERT INTO `article` (`title`, `description`) VALUES (‘Article title’,


‘Description’);
• EACH TABLE HAS ITS OWN “MODEL”. YOU CAN USE THE MODEL TO READ,
INSERT, UPDATE OR
DELETE ROW FROM THE SPECIFIC TABLE
• LET’S CHECK ONE MODEL
Best practices
in
• NEVER write queries or model logic
inside the controller! The controller job is
to
communicate with the model and pass data
to the view.
Views
mobility
Extend and include partials. For example
share the same form fields on 2 pages –
add and edit
Forms security
Always use the CSRF token protection that Laravel provides in forms you create,
the hackers will not be able to spam your forms and
database
Database
architecture
Be careful with the database architecture, always use the proper length for
specific column and never
forget the indexes for searchable columns
Big
• AvoidQuery
the big query unless you
really have to do it. The big query
is hard to debug and understand.
• You can merge the small queries
into one to save the CPU time on
server, but sometimes the query
becomes way too big.
Don’t forget the
PHPDoc
Don’t forget to write comments for each
method or complicated logic.
The PHPDoc comments are helping the IDE
to autosuggest easier and the developers to
understand the piece of code
Thank You!

Presentation Video Link:


https://drive.google.com/file/d/1lQe2hmCTnNH5eTvv4koQWpGgp1jSRYOu/view?usp=sharing

You might also like