0% found this document useful (0 votes)
37 views48 pages

A543001469 - 24 - 2025 - Lec 1

Laravel is a robust PHP framework based on the MVC architecture, designed for developing complex and secure web applications with a rich set of features. It includes tools like Eloquent ORM, Blade templating, and Artisan CLI, which enhance the developer experience and streamline the development process. The document also outlines the MVC structure, its components, and the organization of a Laravel application, emphasizing its scalability and community support.

Uploaded by

Ramu lal Sharma
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)
37 views48 pages

A543001469 - 24 - 2025 - Lec 1

Laravel is a robust PHP framework based on the MVC architecture, designed for developing complex and secure web applications with a rich set of features. It includes tools like Eloquent ORM, Blade templating, and Artisan CLI, which enhance the developer experience and streamline the development process. The document also outlines the MVC structure, its components, and the organization of a Laravel application, emphasizing its scalability and community support.

Uploaded by

Ramu lal Sharma
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/ 48

Introduction

• Laravel is a powerful PHP framework based on MVC


(Model-View-Controller) architecture.

• The Laravel Framework is used to develop complex


Web Applications. Laravel can help a developer to
develop a secure web application.
• It is a Scalable framework and it also has a wide
Community across the world.
• A Framework provides structure and a starting point for
creating your application.

• It helps to provide an amazing developer experience


while providing powerful features through dependency.

• Laravel is a Full Stack Framework, Which helps a


developer create Full Stack Applications.
Versions
• Laravel 1
• Laravel 2
• Laravel 3
• Laravel 4
• Laravel 5
• Laravel 6
• Laravel 7
• Laravel 8
• Laravel 9
• Laravel 10
• Laravel 11
Features of Laravel
• Eloquent ORM: Simplifies database interactions.
• Blade Templating: Efficient and clean HTML templates.
• Routing: Easy-to-manage route definitions.
• Artisan CLI: Powerful command-line tools for development.
• Authentication: Built-in user login and security.
• Testing: Automated testing support with PHPUnit.
Why Laravel
• A Scalable Framework

• Considerable time is saved in designing the web application due to reusability

• Laravel may serve as a full stack framework. By "full stack" framework it


means that you are going to use Laravel to route requests to your application
and render your frontend via Blade templates.

• Laravel has a very rich set of features which will boost the speed of web
development.
We will use the terms
• Composer
• Artisan
• MVC
• Eloquent ORM
• Blade
• Routing
Composer
• Composer is a dependency manager for a PHP.
• The main purpose of the composer is to install the dependencies or
libraries for an application.
• Composer runs through the command line.
• Composer runs through the command line. The main
purpose of the composer is to install
the dependencies or libraries for an application.

• The composer also provides the users to install the PHP


applications available on the Packagist, where
Packagist is the main repository that contains all the
available packages.
• Composer provides autoloading capabilities for libraries
to ease the usage of third-party code.

• If you don't have Composer installed on your computer, first visit this
URL to download Composer:

• https://getcomposer.org/download/
Artisan
• Artisan is a command-line interface that Laravel
provides, which helps make the production process fast
and easy. Laravel has its own Command Line interface
called Artisan

• With this command-line tool, we can make models,


controllers, and can do data migrations and many more.
How to install composer
• o download the Composer for Windows, click on the
link Composer-Setup.exe.
• On clicking the above link, the Composer-
Setup.exe file gets downloaded.
• To install the Composer, run the downloaded file.
• After clicking on the downloaded file, the screen
appears shown below:
• Select the Developer mode in the above screen and
click on the Next button.
• Select the path in which you want to install the setup of
the composer, and then click on the Next button.
• Select the path of command-line PHP and the path is
"c:\Xampp\bin\php\php5.6.40\php.exe".
• If you want to use a proxy, then check the box of the
proxy server and enter proxy url. Here, I am using
Composer without a proxy server, so I uncheck the box.
Click on the Next button.
• The below screen shows that the setup is ready to
install, click on the Install button.
• After clicking on the install button, the screen appears
shown below:
• Click on the Next button.
• If you want to see the online documentation, then check the box of
"View online documentation" and click on the Finish button.
• The installation of the composer is completed.
Now we will check whether the composer is
installed successfully or not. To check this, open
the command prompt and type Composer.
MVC Architecture
MVC Architecture
• MVC based framework mainly divides the whole
application into three components:
1. Model: It interacts with the database.
2. View: User Interface. It contains everything which a
user can see on the screen.
3. Controller: It helps to connect Model and View and
contains all the business logic. It is also known as
the “Heart of the application in MVC”.
Model:

• This component of the MVC framework handles data


used in your application. It helps to retrieve the data
from the database and then perform some operation
that your application is supposed to perform then it
stores that data back in the database.
• In simple words, we can say that Model is responsible
for managing data that is passed between the database
and the User Interface (View).
View:

• This component is User Interface, which defines the


template which is sent as a response to the browser.

• This View components contain the part of code which


helps to display data to the User Interface on the
user’s browser.

• For example, we can say the buttons, textbox,


dropdown menu, and many more such widgets on the
browser screen are the part of View Component.
Controller:

• his controller component helps to interact with the


model component to fetch data from the database and
then pass that data to the view component to get the
desired output on the user’s browser screen.
• Same way, when the user enters some data the
controller fetches that data and then performs some
operation or just inserts that data into the database
with the use of the model components.
Why MVC ?

• It is mainly used to separate Application code into user


interfaces, data, and controlling logic.

• It can benefit the developer to easily maintain the code


which can help to make a development process much
smoother.
Advantages of Using MVC
framework:
• Organizing large-scale web application projects.
• Easier to perform Modification.
• Modification in any part won’t affect any other part of
the code.
• Helps in a faster development process.
• Helps for Asynchronous Method Invocation.
• Nowadays, MVC is one of the most frequently used
industry-standard web development frameworks to
create scalable and extensible projects. It is also used
for designing mobile apps.
Features of MVC

• It provides a clear separation of business logic, UI


logic, and input logic.
• It offers full control over your HTML and URLs which
makes it easy to design web application architecture.
• It is a powerful URL-mapping component using which
we can build applications that have comprehensible and
searchable URLs.
• It supports Test Driven Development (TDD).
Components of MVC
The MVC framework includes the
following 3 components

• Controller
• Model
• View
Responsibilities of controller:

• Receiving user input and interpreting it.


• Updating the Model based on user actions.
• Selecting and displaying the appropriate View.
• Example: In a bookstore application, the Controller
would handle actions such as searching for a book,
adding a book to the cart, or checking out.
Responsibilities of view:
• Responsibilities:
• Rendering data to the user in a specific format.
• Displaying the user interface elements.
• Updating the display when the Model changes.
• Example: In a bookstore application, the View would
display the list of books, book details, and provide input
fields for searching or filtering books.
Responsibilities of model:
• Responsibilities:
• Managing data: CRUD (Create, Read, Update, Delete)
operations.
• Enforcing business rules.
• Notifying the View and Controller of state changes.
• Example: In a bookstore application, the Model would
handle data related to books, such as the book title,
author, price, and stock level.
Disadvantages of MVC

• It is difficult to read, change, test, and reuse this model


• It is not suitable for building small applications.
• The inefficiency of data access in view.
• The framework navigation can be complex as it
introduces new layers of abstraction which requires
users to adapt to the decomposition criteria of MVC.
• Increased complexity and Inefficiency of data
Laravel Application Structure
• The application structure is the structure of folders, sub-
folders, and files available in the project. Once the
project is created in Laravel, the application structure is
generated as shown in the below screenshot:
Laravel's app directory
• he app folder is one of the major folders in Laravel as
most of the code is written in the app folder. The App
folder contains the following sub-folders:
Console
• Console folder contains the artisan commands required
for Laravel. It contains the commands which are
declared with the appropriate signature.
Exceptions
• Exceptions folder contains the various exception
handlers. It handles the exceptions thrown by the
Laravel project. The Exceptions directory contains the
methods that handle the exceptions.
• The Exceptions directory contains the file handle.php
that handles all the exceptions.
Http
• The http folder is a sub-folder of the app folder. It has
sub-folders such as controllers, middleware, and
requests. Laravel follows the MVC architecture, so http
includes controllers, views, and requests.
• Middleware: It is a sub-folder of the http directory. It
provides a filter mechanism and communication
between request and response.
• Requests: It is a sub-folder of http which includes all
the requests of an application.
Providers
• The Providers directory is used to contain all the service
providers that are required to register events for core
servers and provides configuration for Laravel
application.
Laravel's bootstrap directory

• The bootstrap directory holds the files that are required


to bootstrap the Laravel application and to configure
auto-loading. The bootstrap folder contains a sub-folder
cache used for caching a web application. It also
contains the file app.php that initializes the scripts
required for bootstrap
Laravel's config directory
• The config's directory contains the various configuration
files required for the Laravel application. Various files
are available inside the config's directory shown in the
below screenshot, and each file performs their
functionalities as per their names.
Laravel's Database directory
• The database directory holds the database files. It
contains sub-folders factories, migrations,
and seeds. The structure of the database directory is
shown below:
Laravel's Public directory
• The public directory is a root folder that contains the
front controllers used for initializing the Laravel web
application. Following are the sub-folders of a public
directory:
• htaaccess: It is used for the server configuration.
• Javascript and CSS: These files are considered as the
main assets of a web application.
• index.php: This file is used for initializing the web
application.
END

You might also like