0% found this document useful (0 votes)
12 views

Lesson-8-intro-to-Laravel

This document provides an introduction to Laravel, a PHP framework for developing web applications using the MVC architecture. It outlines the learning objectives, installation steps, and directory structure of a Laravel application, including key components such as routes, controllers, and views. Additionally, it explains the request lifecycle and the role of middleware in handling HTTP requests within the application.

Uploaded by

owekesa361
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views

Lesson-8-intro-to-Laravel

This document provides an introduction to Laravel, a PHP framework for developing web applications using the MVC architecture. It outlines the learning objectives, installation steps, and directory structure of a Laravel application, including key components such as routes, controllers, and views. Additionally, it explains the request lifecycle and the role of middleware in handling HTTP requests within the application.

Uploaded by

owekesa361
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 26

Lesson 8

Introduction to Laravel
PHP Framework

1
Session One Learning Objectives
• At the end of this Session/Topic, the Learner should
be able to:

i. Define the term web application


ii. Define a web application framework such as Laravel
iii. Install Laravel in a windows WAMP server
iv. Configure the Laravel .env File
v. Create Basic Routes, Controllers and Views

2
Introduction

• Laravel is a free, open source PHP web application


framework, designed for the development of model-view-
controller (MVC) web applications.

• Laravel allows you to develop applications which are flexible,


user-friendly and clean.

• The pe-requiste for this course is the knowledge of PHP,


JavaScript, OO PHP and MYSQL database design

• 3
Introduction(cont.)

• In this Course, we will begin by preparing a environment and


learning how to download and install Laravel, how to use
Composer to install Laravel, how to use Artisan (the Laravel
command line tool), how to work with Routes, Views, Blade
templates, Controllers and Models.

4
Laravel Installation Steps

• Install Wamp Server(use Bitnami Wamp)

• Install Composer

• Install Laravel

• Configure Laravel

5
Dev Tools Required

WAMP packaged
by Bitnami

6
Supportive Websites

7
Directory Structure Of Laravel
Application

8
Laravel: Main Application
Folders

• Each of these folders


app bootstrap database public fulfills a specific task
for the overall
functioning of the
resources routes storage framework.

• The purpose of each


of these folders is
tests vendor nodes_modules
explained below:

9
The App Directory

Directory Purpose

This directory contains all Artisan commands


which are created by us.
Console These commands can be generated using
the php artisan make: command command.

This directory contains the application’s


exception handling files.
Exceptions Here you can create your own specific
exceptions to be thrown by our application.

10
The App Directory(cont.)
• This directory contains our controllers, middleware,
and form requests.
Http
• Almost all of the backend to handle requests entering
our application will be placed here.

• This directory contains all of the service providers for


the application.
Providers
• Service providers bootstrap our application by making
services available to us by registering them.

• This directory is not there by default but can be


created by using the php artisan
Broadcasting make:channel command.
• It contains all of the broadcast channel classes for our
application to broadcast your events.
11
The App Directory(cont.)

• This directory is not there by default but can be created by


using the php artisan make:event command.
Events
• This directory contains event classes which can be used to
give signals to other parts of the application or vice-versa.

• This directory is not there by default but can be created by


Jobs using the php artisan make:job command.
• This directory contains lineup jobs for our application.

This directory is not there by default but can be created by


Listener •
using the php artisan make:listener command.
s
• This directory contains the classes that handle our events.

12
The App Directory(cont.)
• This directory is not there by default but can be created by using the php
artisan make:mail command.
Mail
• This directory contains all of our classes that represent emails sent by
application.

• This directory is not there by default but can be created by using the php
artisan make:notification command.
Notifications
• This directory contains all of the “transactional” notifications that are
sent by our application.

• This directory is not there by default but can be created by using the php
artisan make:policy command.
Policies
• This directory contains the authorization policy classes which are used to
determine if a user can access or change a specific data or not.

• This directory is not there by default but can be created by using the php
Rules artisan make:rule command.
• This directory contains the self-created validation rule objects which are
used to encapsulate complicated validation logic in a simple object.

13
The Bootstrap Directory

• This directory contains app.php from where the


whole framework bootstraps.

• This directory also contains the cache directory


which is used to store framework generated files for
performance optimization.

14
The config directory
• This directory contains all the configuration files
related to database, mail, session, services, etc.

15
The database Directory
• This directory contains database migrations, model
factories, and seeds.

16
The public Directory

• This directory contains the index.php file which is


the entry point and handles all requests received by
the application and configures autoloading too.

• Apart from this, this directory also contains assets


used in the application like images, javaScript, and
CSS.

17
The resources Directory
• This directory contains the frontend of the
application.

• All the HTML code which makes the frontend of


application is present here in the form of Blade
templates which is a templating engine Laravel
comes with.

18
The routes directory:
• This directory contains all the route definitions of
the application.

19
The storage Directory:
• This directory contains the compiled Blade
templates, file based sessions, file caches, and other
files generated by framework.

20
The tests Directory:
• This directory contains all of our automated tests
which are required to ensure that the application is
working as per expectations or not.

21
The vendor Directory:
• This directory contains all the dependencies
downloaded through Composer needed by our
framework.

22
Middleware
• Middleware provide a convenient mechanism for
filtering or examining HTTP requests entering your
application.

• For example, Laravel includes a middleware that


verifies if the user of your application is
authenticated.

• If the user is not authenticated, the middleware


will redirect the user to the login screen.

• However, if the user is authenticated, the


middleware will allow the request to proceed
further into the application. 23
Request Lifecycle
• The entry point for all requests to a Laravel
application is the public/index.php file.

• All requests are directed to this file by your web


server (Apache / Nginx) configuration.

• The index.php file doesn't contain much code.

• Rather, it is a starting point for loading the rest of the


framework.
24
Request Lifecycle(cont.)

• The index.php file loads the Composer generated


autoloader definition, and then retrieves an
instance of the Laravel application from
bootstrap/app.php.

• The first action taken by Laravel itself is to create an


instance of the application / service container.

25
The end
Thank you

26

You might also like