2. A quick Brief about the Laravel
PHP Framework
Laravel PHP framework is an open-source web application framework.
It is one of the most preferred frameworks for enterprise applications
because of its several outstanding features. They are:
01 02 03 04 05
Creative
independence
for web
developers
In-expensive
and
customizable
Easy and
safe data
migration
Highly
secure
Interactive
community
support
06
Easy testing
and execution
3. How to install Laravel for the 1st time
• Installation Guide:
https://www.youtube.com/watch?v=2qgS_MCvDfk&list=PPSV
• To install Laravel Framework you need to download:
1. XAMPP or WAMP
XAMPP is a free and open-source cross-platform web server solution
stack package
2. Composer
3. Visual Studio Code or PHP Storm (requires a license)
4. Install Laravel Framework extension to Visual Studio Code or
PHP Storm
4. Composer Tool
Dependency management
• It manages them on a per-project basis, installing them in a
directory (e.g. vendor) inside your project.
• By default, it does not install anything globally. Thus, it is a
dependency manager.
• It does however support a "global" project for convenience via
the global command.
• Composer is a tool for dependency management
in PHP.
• It allows you to declare the libraries your project
depends on and it will manage (install/update)
them for you.
5. Composer Tool
• Suppose:
1. You have a project that depends on a number of
libraries.
2. Some of those libraries depend on other libraries.
• Composer:
1. Enables you to declare the libraries you depend on.
2. Finds out which versions of which packages can and
need to be installed, and installs them (meaning it
downloads them into your project).
3. You can update all your dependencies in one
command.
6. Visual Studio Code
• Visual Studio Code is not the same as Visual Studio IDE.
• A lightweight powerful
source code editor.
• Runs on Windows,
macOS and Linux.
• It comes with built-in
support for JavaScript,
TypeScript and Node.js
• Has extensions for
other languages and
runtimes (such as C++,
C#, Java, Python, PHP,
Go, .NET)
7. Visual Studio Code
• Open VS terminal and use the following two commands
• Open terminal and choose a folder then write the following commands
1. Install the Laravel Framework Extension
• Choose a Folder and create a new application using :
• Use Serve command this will make your app accessible through
http://127.0.0.1:8000/ by default
composer global require laravel/installer
laravel new example-app
php artisan serve
9. Artisan
● An artisan is a built-in
tool for command line
in Laravel.
● Command line
interface.
● performs all the
repetitive
programming tasks
that most of the
developers want to
avoid to do manually.
10. Eloquent ORM
The Eloquent ORM
provides a simple PHP
Active Record
implementation.
Compared to all other
PHP frameworks, an
ORM is relatively
faster.
11. Another advantage of
Laravel is its object
Oriented libraries and
other pre-installed
libraries.
The best part of it is
easy-to-implement.
Libraries &
Modular
13. Without re-creating
the structure of
databases of the web
application, the
Laravel migration
system helps the PHP
developers to expand
the structure of the
database and to make
a change.
Migration system
for databases
14. Due to unit-testing,
many developers like
Laravel as it is capable
of running many tests
that gives surety that
the changes made by
developers on the
programme do not
break the web
application.
Unit-Testing
15. Laravel framework
provides powerful
web application
security.
All thanks to the
hashed and salted
password mechanism
that never save the
password as plain
text in the database.
Security
16. Directory Structure
• The default Laravel application
structure is intended to provide a great
starting point for both large and small
applications.
• You are free to organize your
application however you like.
• Laravel imposes almost no restrictions
on where any given class is located - as
long as Composer can autoload the
class.
17. Directory Structure
1. The App Directory
• Contains the core code of
your application.
• All of the classes in your
application will be in this
directory.
18. Directory Structure
2. The bootstrap Directory (Autoloading)
• Contains the app.php file that loads
and initialize the app.
• Houses a cache directory which
contains framework generated files for
performance optimization such as the
route and services cache files.
• You should not typically need to
modify any files within this directory.
19. Directory Structure
2. The bootstrap Directory (Autoloading)
Inside the bootstrap folder you will find a
few files:
• autoload.php - loads and includes
composer so any packages are loaded.
• services.php - stores the providers in the
application to load the system quicker.
• app.php - loads and initializes the app.
20. Directory Structure
3. The config Directory
• The config directory, as the name
implies, contains all of your
application's configuration files.
• Include configurations such as
database, mail, sessions, and
authorizations.
21. Directory Structure
4. The database Directory
• Contains your database
migrations, model factories, and
seeds.
• You may also use this directory to
hold an SQLite database files.
• Contains seedings (test data in
DB).
22. Directory Structure
5. The public Directory
• Contains frontend related files.
• Includes the index.php file, which
is the entry point for all requests
entering your application and
configures autoloading.
• This directory also houses your
assets such as images, JavaScript,
and CSS.
23. Directory Structure
6. The resouces Directory
• Contains your views as well as
your raw using Blade template.
• Un-compiled assets such as CSS or
JavaScript.
• Localization files for
multilanguages.
24. Directory Structure
7. The routes Directory
• Routing is what happens when an
application determines which
controllers and actions are
executed based on the URL
requested.
• It is how the framework gets from
http://localhost/users/list.html to
the Users controller and the list()
action.
25. Directory Structure
8. The storage Directory
• contains your logs, compiled
Blade templates, file based
sessions, file caches, and other
files generated by the framework.
• Can be used to store any files
generated by your application.
26. Directory Structure
8. The tests Directory
• Contains your automated tests.
• Uses PHPUnit unit tests and
feature tests are provided out of
the box.
• Each test class should be suffixed
with the word Test.
• You may run your tests using the
phpunit or
php vendor/bin/phpunit commands.
30. Adding Code Snippet
• Code snippets are templates that make it
easier to enter repeating code patterns,
such as loops or conditional-statements.
• In Visual Studio Code, snippets appear in
IntelliSense (Ctrl+Space) mixed with other
suggestions, as well as in a dedicated
snippet picker