SlideShare a Scribd company logo
Object-Oriented
Programming
(with Laravel)
By: Shahrzad Peyman
Session 2
April-2017
shahrzad.peyman@gmail.com
1
2
Today’s Presentation
• Encapsulation, Access Level and Inheritance
• Local Development Server
• Front Controller
• Configuration
• Directory Structure
• The Root Directory
• The App Directory
• Routing
• Controllers
Encapsulation
• In basic terms, it’s the way we define the
visibility of our properties and methods.
• When you’re creating classes, you have to
ask yourself what properties and methods
can be accessed outside of the class.
3
Access Levels
Specifier Class SubClass all
Private *
Protected * *
Public * * *
4
Inheritance
• In object-oriented programming, inheritance
is when a class is based on another class,
using the same implementation or specifying
a new implementation to maintain the same
behavior.
• Such an inherited class is called a subclass
of its parent class or super class.
5
Inheritance
6
Inheritance
7
Local Development Server
• If you have PHP installed locally and you
would like to use PHP's built-in development
server to serve your application, you may use
the serve artisan command.
• This command will start a development
server at http://localhost:8000
• Of course, more robust local development
options are available via Homestead and Valet.
8
Front Controller
• Like HTTP itself, the Request and Response objects are
pretty simple. The hard part of building an application
is writing what comes in between. In other words, the
real work comes in writing the code that interprets the
request information and creates the response
• Your application probably does many things, like
sending emails, handling form submissions, saving
things to a database, rendering HTML pages and
protecting content with security. How can you manage
all of this and still keep your code organized and
maintainable?
Front Controller
• Traditionally, applications were built so that each
"page" of a site was its own physical file:
A. index.php
B. contact.php
C. blog.php
• There are several problems with this approach,
including the inflexibility of the URLs (what if you
wanted to change blog.php to news.php without
breaking all of your links?) and the fact that each
file must manually include some set of core files
so that security, database connections and the
"look" of the site can remain consistent.
Front Controller
• A much better solution is to use a front
controller: a single PHP file that handles
every request coming into your application.
• Now, every request is handled exactly the
same way. Instead of individual URLs
executing different PHP files, the front
controller is always executed, and the routing
of different URLs to different parts of your
application is done internally.
Configuration
Public Directory:
After installing Laravel, you should configure
your web server's document / web root to be
the public directory.
The index.php in this directory serves as the
front controller for all HTTP requests entering
your application.
12
Configuration
Config Directory:
All of the configuration files for the Laravel
framework are stored in the config directory.
Application Key:
The next thing you should do after installing Laravel
is set your application key to a random string. If you
installed Laravel via Composer or the Laravel
installer, this key has already been set for you by the
php artisan key:generate command.
13
Configuration
Configuration Caching:
To give your application a speed boost, you should
cache all of your configuration files into a single file
using the config:cache Artisan command.
This will combine all of the configuration options for
your application into a single file which will be loaded
quickly by the framework.
14
Configuration
Maintenance Mode:
When your application is in maintenance mode, a
custom view will be displayed for all requests into
your application. This makes it easy to "disable"
your application while it is updating or when you are
performing maintenance.
To enable maintenance mode, simply execute the
down Artisan command: php artisan down.
To disable maintenance mode, use the up command.
15
Directory Structure
The default Laravel application structure is
intended to provide a great starting point for
both large and small applications. Of course, you
are free to organize your application however
you like.
Where is Models Directory?
16
The Root Directory
• App
• Bootstrap
• Config
• Database
• Public
• Resources
• Routes
• Storage
• Tests
• Vendor
17
18
The App Directory
The majority of your application is housed in the App
directory. By default, this directory is namespaced under
App and is autoloaded by Composer using the PSR-4
autoloading standard.
The App directory contains a variety of additional
directories such as Console, Http and Providers. Think of
the Console and Http directories as providing an API into
the core of your application. The HTTP protocol and CLI
are both mechanisms to interact with your application,
but do not actually contain application logic.
Routing
The most basic Laravel routes simply accept a
URI and a Closure, providing a very simple and
expressive method of defining routes:
All Laravel routes are defined in your route
files, which are located in the routes directory.
19
Available Router Methods
20
Route Parameters
21
Regular Expression Constraints
22
Global Constraints
If you would like a route parameter to always be
constrained by a given regular expression, you
may use the pattern method. You should define
these patterns in the boot method of your
RouteServiceProvider:
23
24
Named Routes
25
Route Prefixes
26
Controllers
Instead of defining all of your request handling logic as
Closures in route files, you may wish to organize this
behavior using Controller classes. Controllers can group
related request handling logic into a single class.
Controllers are stored in the app/http/controllers directory.
Single Action Controllers
27

More Related Content

What's hot

Laravel - The PHP Framework for Web Artisans
Laravel - The PHP Framework for Web ArtisansLaravel - The PHP Framework for Web Artisans
Laravel - The PHP Framework for Web Artisans
Windzoon Technologies
 
Introduction to laravel framework
Introduction to laravel frameworkIntroduction to laravel framework
Introduction to laravel framework
Ahmad Fatoni
 
Laravel Blade Template
Laravel Blade TemplateLaravel Blade Template
Laravel Blade Template
Mindfire Solutions
 
Laravel introduction
Laravel introductionLaravel introduction
Laravel introduction
Simon Funk
 
Laravel tutorial
Laravel tutorialLaravel tutorial
Laravel tutorial
Broker IG
 
Laravel development (Laravel History, Environment Setup & Laravel Installatio...
Laravel development (Laravel History, Environment Setup & Laravel Installatio...Laravel development (Laravel History, Environment Setup & Laravel Installatio...
Laravel development (Laravel History, Environment Setup & Laravel Installatio...
Dilouar Hossain
 
What-is-Laravel-23-August-2017.pptx
What-is-Laravel-23-August-2017.pptxWhat-is-Laravel-23-August-2017.pptx
What-is-Laravel-23-August-2017.pptx
AbhijeetKumar456867
 
Web Development with Laravel 5
Web Development with Laravel 5Web Development with Laravel 5
Web Development with Laravel 5
Soheil Khodayari
 
Laravel ppt
Laravel pptLaravel ppt
Laravel ppt
Mayank Panchal
 
Node.js Express Tutorial | Node.js Tutorial For Beginners | Node.js + Expres...
Node.js Express Tutorial | Node.js Tutorial For Beginners | Node.js +  Expres...Node.js Express Tutorial | Node.js Tutorial For Beginners | Node.js +  Expres...
Node.js Express Tutorial | Node.js Tutorial For Beginners | Node.js + Expres...
Edureka!
 
Projects In Laravel : Learn Laravel Building 10 Projects
Projects In Laravel : Learn Laravel Building 10 ProjectsProjects In Laravel : Learn Laravel Building 10 Projects
Projects In Laravel : Learn Laravel Building 10 Projects
Sam Dias
 
Why Laravel?
Why Laravel?Why Laravel?
Why Laravel?
Jonathan Goode
 
Laravel Tutorial PPT
Laravel Tutorial PPTLaravel Tutorial PPT
Laravel Tutorial PPT
Piyush Aggarwal
 
React JS - A quick introduction tutorial
React JS - A quick introduction tutorialReact JS - A quick introduction tutorial
React JS - A quick introduction tutorial
Mohammed Fazuluddin
 
What is REST API? REST API Concepts and Examples | Edureka
What is REST API? REST API Concepts and Examples | EdurekaWhat is REST API? REST API Concepts and Examples | Edureka
What is REST API? REST API Concepts and Examples | Edureka
Edureka!
 
Building Web Apps with WebAssembly and Blazor
Building Web Apps with WebAssembly and BlazorBuilding Web Apps with WebAssembly and Blazor
Building Web Apps with WebAssembly and Blazor
Amir Zuker
 
Understanding Reactive Programming
Understanding Reactive ProgrammingUnderstanding Reactive Programming
Understanding Reactive Programming
Andres Almiray
 
React Native Workshop
React Native WorkshopReact Native Workshop
React Native Workshop
Amazon Web Services
 
Object Oriented Programming In JavaScript
Object Oriented Programming In JavaScriptObject Oriented Programming In JavaScript
Object Oriented Programming In JavaScript
Forziatech
 

What's hot (20)

Laravel - The PHP Framework for Web Artisans
Laravel - The PHP Framework for Web ArtisansLaravel - The PHP Framework for Web Artisans
Laravel - The PHP Framework for Web Artisans
 
Introduction to laravel framework
Introduction to laravel frameworkIntroduction to laravel framework
Introduction to laravel framework
 
Laravel Blade Template
Laravel Blade TemplateLaravel Blade Template
Laravel Blade Template
 
Laravel introduction
Laravel introductionLaravel introduction
Laravel introduction
 
Laravel tutorial
Laravel tutorialLaravel tutorial
Laravel tutorial
 
Laravel development (Laravel History, Environment Setup & Laravel Installatio...
Laravel development (Laravel History, Environment Setup & Laravel Installatio...Laravel development (Laravel History, Environment Setup & Laravel Installatio...
Laravel development (Laravel History, Environment Setup & Laravel Installatio...
 
What-is-Laravel-23-August-2017.pptx
What-is-Laravel-23-August-2017.pptxWhat-is-Laravel-23-August-2017.pptx
What-is-Laravel-23-August-2017.pptx
 
Web Development with Laravel 5
Web Development with Laravel 5Web Development with Laravel 5
Web Development with Laravel 5
 
Laravel ppt
Laravel pptLaravel ppt
Laravel ppt
 
Node.js Express Tutorial | Node.js Tutorial For Beginners | Node.js + Expres...
Node.js Express Tutorial | Node.js Tutorial For Beginners | Node.js +  Expres...Node.js Express Tutorial | Node.js Tutorial For Beginners | Node.js +  Expres...
Node.js Express Tutorial | Node.js Tutorial For Beginners | Node.js + Expres...
 
Projects In Laravel : Learn Laravel Building 10 Projects
Projects In Laravel : Learn Laravel Building 10 ProjectsProjects In Laravel : Learn Laravel Building 10 Projects
Projects In Laravel : Learn Laravel Building 10 Projects
 
Why Laravel?
Why Laravel?Why Laravel?
Why Laravel?
 
Laravel Tutorial PPT
Laravel Tutorial PPTLaravel Tutorial PPT
Laravel Tutorial PPT
 
React JS - A quick introduction tutorial
React JS - A quick introduction tutorialReact JS - A quick introduction tutorial
React JS - A quick introduction tutorial
 
What is REST API? REST API Concepts and Examples | Edureka
What is REST API? REST API Concepts and Examples | EdurekaWhat is REST API? REST API Concepts and Examples | Edureka
What is REST API? REST API Concepts and Examples | Edureka
 
Express node js
Express node jsExpress node js
Express node js
 
Building Web Apps with WebAssembly and Blazor
Building Web Apps with WebAssembly and BlazorBuilding Web Apps with WebAssembly and Blazor
Building Web Apps with WebAssembly and Blazor
 
Understanding Reactive Programming
Understanding Reactive ProgrammingUnderstanding Reactive Programming
Understanding Reactive Programming
 
React Native Workshop
React Native WorkshopReact Native Workshop
React Native Workshop
 
Object Oriented Programming In JavaScript
Object Oriented Programming In JavaScriptObject Oriented Programming In JavaScript
Object Oriented Programming In JavaScript
 

Similar to Object Oriented Programming with Laravel - Session 2

Lecture11_LaravelGetStarted_SPring2023.pdf
Lecture11_LaravelGetStarted_SPring2023.pdfLecture11_LaravelGetStarted_SPring2023.pdf
Lecture11_LaravelGetStarted_SPring2023.pdf
ShaimaaMohamedGalal
 
Laravel (8) php_framework_handbook__start_from_zer_18604872_(z-lib.org)
Laravel (8) php_framework_handbook__start_from_zer_18604872_(z-lib.org)Laravel (8) php_framework_handbook__start_from_zer_18604872_(z-lib.org)
Laravel (8) php_framework_handbook__start_from_zer_18604872_(z-lib.org)
ssuser337865
 
Laravel Starter Kit | Laravel Admin Template-ChandraAdmin
Laravel Starter Kit | Laravel Admin Template-ChandraAdmin Laravel Starter Kit | Laravel Admin Template-ChandraAdmin
Laravel Starter Kit | Laravel Admin Template-ChandraAdmin
Lorvent56
 
Laravel - A Trending PHP Framework
Laravel - A Trending PHP FrameworkLaravel - A Trending PHP Framework
Laravel - A Trending PHP Framework
ijtsrd
 
Laravel
LaravelLaravel
Laravel
Himani gajjar
 
introduction to web programming using PHP
introduction to web programming using PHPintroduction to web programming using PHP
introduction to web programming using PHP
vishnupriyapm4
 
Frequently Asked Questions About Laravel
Frequently Asked Questions About LaravelFrequently Asked Questions About Laravel
Frequently Asked Questions About Laravel
AResourcePool
 
Laravel : A Fastest Growing Kid
Laravel : A Fastest Growing KidLaravel : A Fastest Growing Kid
Laravel : A Fastest Growing Kid
Endive Software
 
Latest Laravel Practice 2023 Experts Guidance.pdf
Latest Laravel Practice 2023 Experts Guidance.pdfLatest Laravel Practice 2023 Experts Guidance.pdf
Latest Laravel Practice 2023 Experts Guidance.pdf
Sufalam Technologies
 
Laravel Web Development: A Comprehensive Guide
Laravel Web Development: A Comprehensive GuideLaravel Web Development: A Comprehensive Guide
Laravel Web Development: A Comprehensive Guide
deep9753ak
 
Top 10 php frameworks in 2021
Top 10 php frameworks in 2021Top 10 php frameworks in 2021
Top 10 php frameworks in 2021
MaryamAnwar10
 
Unit Test for ZF SlideShare Component
Unit Test for ZF SlideShare ComponentUnit Test for ZF SlideShare Component
Unit Test for ZF SlideShare Component
Kaiuwe
 
Unit Test for ZF SlideShare Component
Unit Test for ZF SlideShare ComponentUnit Test for ZF SlideShare Component
Unit Test for ZF SlideShare Component
Kaiuwe
 
Laravel & Composer presentation - extended
Laravel & Composer presentation - extendedLaravel & Composer presentation - extended
Laravel & Composer presentation - extended
Cvetomir Denchev
 
Memphis php 01 22-13 - laravel basics
Memphis php 01 22-13 - laravel basicsMemphis php 01 22-13 - laravel basics
Memphis php 01 22-13 - laravel basics
Joe Ferguson
 
Web presentation
Web presentationWeb presentation
Web presentation
Solaiman Hossain Tuhin
 
Laravel 9_ Unlock the Exciting Features Here!.pptx
Laravel 9_ Unlock the Exciting Features Here!.pptxLaravel 9_ Unlock the Exciting Features Here!.pptx
Laravel 9_ Unlock the Exciting Features Here!.pptx
Elsner Technologies Pvt. Ltd.
 
Who Should Consider Using Laravel for Web Development?
Who Should Consider Using Laravel for Web Development?Who Should Consider Using Laravel for Web Development?
Who Should Consider Using Laravel for Web Development?
Acquaint Softtech Private Limited
 
Prominent Back-end frameworks to consider in 2022!
Prominent Back-end frameworks to consider in 2022!Prominent Back-end frameworks to consider in 2022!
Prominent Back-end frameworks to consider in 2022!
Shelly Megan
 

Similar to Object Oriented Programming with Laravel - Session 2 (20)

Lecture11_LaravelGetStarted_SPring2023.pdf
Lecture11_LaravelGetStarted_SPring2023.pdfLecture11_LaravelGetStarted_SPring2023.pdf
Lecture11_LaravelGetStarted_SPring2023.pdf
 
Laravel (8) php_framework_handbook__start_from_zer_18604872_(z-lib.org)
Laravel (8) php_framework_handbook__start_from_zer_18604872_(z-lib.org)Laravel (8) php_framework_handbook__start_from_zer_18604872_(z-lib.org)
Laravel (8) php_framework_handbook__start_from_zer_18604872_(z-lib.org)
 
Laravel Starter Kit | Laravel Admin Template-ChandraAdmin
Laravel Starter Kit | Laravel Admin Template-ChandraAdmin Laravel Starter Kit | Laravel Admin Template-ChandraAdmin
Laravel Starter Kit | Laravel Admin Template-ChandraAdmin
 
Laravel - A Trending PHP Framework
Laravel - A Trending PHP FrameworkLaravel - A Trending PHP Framework
Laravel - A Trending PHP Framework
 
Laravel
LaravelLaravel
Laravel
 
introduction to web programming using PHP
introduction to web programming using PHPintroduction to web programming using PHP
introduction to web programming using PHP
 
cakephp UDUYKTHA (1)
cakephp UDUYKTHA (1)cakephp UDUYKTHA (1)
cakephp UDUYKTHA (1)
 
Frequently Asked Questions About Laravel
Frequently Asked Questions About LaravelFrequently Asked Questions About Laravel
Frequently Asked Questions About Laravel
 
Laravel : A Fastest Growing Kid
Laravel : A Fastest Growing KidLaravel : A Fastest Growing Kid
Laravel : A Fastest Growing Kid
 
Latest Laravel Practice 2023 Experts Guidance.pdf
Latest Laravel Practice 2023 Experts Guidance.pdfLatest Laravel Practice 2023 Experts Guidance.pdf
Latest Laravel Practice 2023 Experts Guidance.pdf
 
Laravel Web Development: A Comprehensive Guide
Laravel Web Development: A Comprehensive GuideLaravel Web Development: A Comprehensive Guide
Laravel Web Development: A Comprehensive Guide
 
Top 10 php frameworks in 2021
Top 10 php frameworks in 2021Top 10 php frameworks in 2021
Top 10 php frameworks in 2021
 
Unit Test for ZF SlideShare Component
Unit Test for ZF SlideShare ComponentUnit Test for ZF SlideShare Component
Unit Test for ZF SlideShare Component
 
Unit Test for ZF SlideShare Component
Unit Test for ZF SlideShare ComponentUnit Test for ZF SlideShare Component
Unit Test for ZF SlideShare Component
 
Laravel & Composer presentation - extended
Laravel & Composer presentation - extendedLaravel & Composer presentation - extended
Laravel & Composer presentation - extended
 
Memphis php 01 22-13 - laravel basics
Memphis php 01 22-13 - laravel basicsMemphis php 01 22-13 - laravel basics
Memphis php 01 22-13 - laravel basics
 
Web presentation
Web presentationWeb presentation
Web presentation
 
Laravel 9_ Unlock the Exciting Features Here!.pptx
Laravel 9_ Unlock the Exciting Features Here!.pptxLaravel 9_ Unlock the Exciting Features Here!.pptx
Laravel 9_ Unlock the Exciting Features Here!.pptx
 
Who Should Consider Using Laravel for Web Development?
Who Should Consider Using Laravel for Web Development?Who Should Consider Using Laravel for Web Development?
Who Should Consider Using Laravel for Web Development?
 
Prominent Back-end frameworks to consider in 2022!
Prominent Back-end frameworks to consider in 2022!Prominent Back-end frameworks to consider in 2022!
Prominent Back-end frameworks to consider in 2022!
 

More from Shahrzad Peyman

Web Design & Development - Session 9
Web Design & Development - Session 9Web Design & Development - Session 9
Web Design & Development - Session 9
Shahrzad Peyman
 
Web Design & Development - Session 8
Web Design & Development - Session 8Web Design & Development - Session 8
Web Design & Development - Session 8
Shahrzad Peyman
 
Web Design & Development - Session 7
Web Design & Development - Session 7Web Design & Development - Session 7
Web Design & Development - Session 7
Shahrzad Peyman
 
Web Design & Development - Session 6
Web Design & Development - Session 6Web Design & Development - Session 6
Web Design & Development - Session 6
Shahrzad Peyman
 
Web Design & Development - Session 4
Web Design & Development - Session 4Web Design & Development - Session 4
Web Design & Development - Session 4
Shahrzad Peyman
 
Web Design & Development - Session 3
Web Design & Development - Session 3Web Design & Development - Session 3
Web Design & Development - Session 3
Shahrzad Peyman
 
Web Design & Development - Session 2
Web Design & Development - Session 2Web Design & Development - Session 2
Web Design & Development - Session 2
Shahrzad Peyman
 
Web Design & Development - Session 1
Web Design & Development - Session 1Web Design & Development - Session 1
Web Design & Development - Session 1
Shahrzad Peyman
 
Object Oriented Programming with Laravel - Session 6
Object Oriented Programming with Laravel - Session 6Object Oriented Programming with Laravel - Session 6
Object Oriented Programming with Laravel - Session 6
Shahrzad Peyman
 
Object Oriented Programming with Laravel - Session 5
Object Oriented Programming with Laravel - Session 5Object Oriented Programming with Laravel - Session 5
Object Oriented Programming with Laravel - Session 5
Shahrzad Peyman
 
Object Oriented Programming with Laravel - Session 4
Object Oriented Programming with Laravel - Session 4Object Oriented Programming with Laravel - Session 4
Object Oriented Programming with Laravel - Session 4
Shahrzad Peyman
 

More from Shahrzad Peyman (11)

Web Design & Development - Session 9
Web Design & Development - Session 9Web Design & Development - Session 9
Web Design & Development - Session 9
 
Web Design & Development - Session 8
Web Design & Development - Session 8Web Design & Development - Session 8
Web Design & Development - Session 8
 
Web Design & Development - Session 7
Web Design & Development - Session 7Web Design & Development - Session 7
Web Design & Development - Session 7
 
Web Design & Development - Session 6
Web Design & Development - Session 6Web Design & Development - Session 6
Web Design & Development - Session 6
 
Web Design & Development - Session 4
Web Design & Development - Session 4Web Design & Development - Session 4
Web Design & Development - Session 4
 
Web Design & Development - Session 3
Web Design & Development - Session 3Web Design & Development - Session 3
Web Design & Development - Session 3
 
Web Design & Development - Session 2
Web Design & Development - Session 2Web Design & Development - Session 2
Web Design & Development - Session 2
 
Web Design & Development - Session 1
Web Design & Development - Session 1Web Design & Development - Session 1
Web Design & Development - Session 1
 
Object Oriented Programming with Laravel - Session 6
Object Oriented Programming with Laravel - Session 6Object Oriented Programming with Laravel - Session 6
Object Oriented Programming with Laravel - Session 6
 
Object Oriented Programming with Laravel - Session 5
Object Oriented Programming with Laravel - Session 5Object Oriented Programming with Laravel - Session 5
Object Oriented Programming with Laravel - Session 5
 
Object Oriented Programming with Laravel - Session 4
Object Oriented Programming with Laravel - Session 4Object Oriented Programming with Laravel - Session 4
Object Oriented Programming with Laravel - Session 4
 

Recently uploaded

Automated software refactoring with OpenRewrite and Generative AI.pptx.pdf
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdfAutomated software refactoring with OpenRewrite and Generative AI.pptx.pdf
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdf
timtebeek1
 
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Globus
 
AI Genie Review: World’s First Open AI WordPress Website Creator
AI Genie Review: World’s First Open AI WordPress Website CreatorAI Genie Review: World’s First Open AI WordPress Website Creator
AI Genie Review: World’s First Open AI WordPress Website Creator
Google
 
OpenMetadata Community Meeting - 5th June 2024
OpenMetadata Community Meeting - 5th June 2024OpenMetadata Community Meeting - 5th June 2024
OpenMetadata Community Meeting - 5th June 2024
OpenMetadata
 
Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024
Globus
 
First Steps with Globus Compute Multi-User Endpoints
First Steps with Globus Compute Multi-User EndpointsFirst Steps with Globus Compute Multi-User Endpoints
First Steps with Globus Compute Multi-User Endpoints
Globus
 
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOMLORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
lorraineandreiamcidl
 
Text-Summarization-of-Breaking-News-Using-Fine-tuning-BART-Model.pptx
Text-Summarization-of-Breaking-News-Using-Fine-tuning-BART-Model.pptxText-Summarization-of-Breaking-News-Using-Fine-tuning-BART-Model.pptx
Text-Summarization-of-Breaking-News-Using-Fine-tuning-BART-Model.pptx
ShamsuddeenMuhammadA
 
Need for Speed: Removing speed bumps from your Symfony projects ⚡️
Need for Speed: Removing speed bumps from your Symfony projects ⚡️Need for Speed: Removing speed bumps from your Symfony projects ⚡️
Need for Speed: Removing speed bumps from your Symfony projects ⚡️
Łukasz Chruściel
 
Orion Context Broker introduction 20240604
Orion Context Broker introduction 20240604Orion Context Broker introduction 20240604
Orion Context Broker introduction 20240604
Fermin Galan
 
Enhancing Research Orchestration Capabilities at ORNL.pdf
Enhancing Research Orchestration Capabilities at ORNL.pdfEnhancing Research Orchestration Capabilities at ORNL.pdf
Enhancing Research Orchestration Capabilities at ORNL.pdf
Globus
 
Vitthal Shirke Java Microservices Resume.pdf
Vitthal Shirke Java Microservices Resume.pdfVitthal Shirke Java Microservices Resume.pdf
Vitthal Shirke Java Microservices Resume.pdf
Vitthal Shirke
 
Navigating the Metaverse: A Journey into Virtual Evolution"
Navigating the Metaverse: A Journey into Virtual Evolution"Navigating the Metaverse: A Journey into Virtual Evolution"
Navigating the Metaverse: A Journey into Virtual Evolution"
Donna Lenk
 
BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024
Ortus Solutions, Corp
 
Enterprise Software Development with No Code Solutions.pptx
Enterprise Software Development with No Code Solutions.pptxEnterprise Software Development with No Code Solutions.pptx
Enterprise Software Development with No Code Solutions.pptx
QuickwayInfoSystems3
 
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Globus
 
Graspan: A Big Data System for Big Code Analysis
Graspan: A Big Data System for Big Code AnalysisGraspan: A Big Data System for Big Code Analysis
Graspan: A Big Data System for Big Code Analysis
Aftab Hussain
 
Empowering Growth with Best Software Development Company in Noida - Deuglo
Empowering Growth with Best Software  Development Company in Noida - DeugloEmpowering Growth with Best Software  Development Company in Noida - Deuglo
Empowering Growth with Best Software Development Company in Noida - Deuglo
Deuglo Infosystem Pvt Ltd
 
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
Mind IT Systems
 
Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
Safe Software
 

Recently uploaded (20)

Automated software refactoring with OpenRewrite and Generative AI.pptx.pdf
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdfAutomated software refactoring with OpenRewrite and Generative AI.pptx.pdf
Automated software refactoring with OpenRewrite and Generative AI.pptx.pdf
 
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
 
AI Genie Review: World’s First Open AI WordPress Website Creator
AI Genie Review: World’s First Open AI WordPress Website CreatorAI Genie Review: World’s First Open AI WordPress Website Creator
AI Genie Review: World’s First Open AI WordPress Website Creator
 
OpenMetadata Community Meeting - 5th June 2024
OpenMetadata Community Meeting - 5th June 2024OpenMetadata Community Meeting - 5th June 2024
OpenMetadata Community Meeting - 5th June 2024
 
Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024
 
First Steps with Globus Compute Multi-User Endpoints
First Steps with Globus Compute Multi-User EndpointsFirst Steps with Globus Compute Multi-User Endpoints
First Steps with Globus Compute Multi-User Endpoints
 
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOMLORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
LORRAINE ANDREI_LEQUIGAN_HOW TO USE ZOOM
 
Text-Summarization-of-Breaking-News-Using-Fine-tuning-BART-Model.pptx
Text-Summarization-of-Breaking-News-Using-Fine-tuning-BART-Model.pptxText-Summarization-of-Breaking-News-Using-Fine-tuning-BART-Model.pptx
Text-Summarization-of-Breaking-News-Using-Fine-tuning-BART-Model.pptx
 
Need for Speed: Removing speed bumps from your Symfony projects ⚡️
Need for Speed: Removing speed bumps from your Symfony projects ⚡️Need for Speed: Removing speed bumps from your Symfony projects ⚡️
Need for Speed: Removing speed bumps from your Symfony projects ⚡️
 
Orion Context Broker introduction 20240604
Orion Context Broker introduction 20240604Orion Context Broker introduction 20240604
Orion Context Broker introduction 20240604
 
Enhancing Research Orchestration Capabilities at ORNL.pdf
Enhancing Research Orchestration Capabilities at ORNL.pdfEnhancing Research Orchestration Capabilities at ORNL.pdf
Enhancing Research Orchestration Capabilities at ORNL.pdf
 
Vitthal Shirke Java Microservices Resume.pdf
Vitthal Shirke Java Microservices Resume.pdfVitthal Shirke Java Microservices Resume.pdf
Vitthal Shirke Java Microservices Resume.pdf
 
Navigating the Metaverse: A Journey into Virtual Evolution"
Navigating the Metaverse: A Journey into Virtual Evolution"Navigating the Metaverse: A Journey into Virtual Evolution"
Navigating the Metaverse: A Journey into Virtual Evolution"
 
BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024
 
Enterprise Software Development with No Code Solutions.pptx
Enterprise Software Development with No Code Solutions.pptxEnterprise Software Development with No Code Solutions.pptx
Enterprise Software Development with No Code Solutions.pptx
 
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
 
Graspan: A Big Data System for Big Code Analysis
Graspan: A Big Data System for Big Code AnalysisGraspan: A Big Data System for Big Code Analysis
Graspan: A Big Data System for Big Code Analysis
 
Empowering Growth with Best Software Development Company in Noida - Deuglo
Empowering Growth with Best Software  Development Company in Noida - DeugloEmpowering Growth with Best Software  Development Company in Noida - Deuglo
Empowering Growth with Best Software Development Company in Noida - Deuglo
 
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...
 
Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
 

Object Oriented Programming with Laravel - Session 2

  • 1. Object-Oriented Programming (with Laravel) By: Shahrzad Peyman Session 2 April-2017 shahrzad.peyman@gmail.com 1
  • 2. 2 Today’s Presentation • Encapsulation, Access Level and Inheritance • Local Development Server • Front Controller • Configuration • Directory Structure • The Root Directory • The App Directory • Routing • Controllers
  • 3. Encapsulation • In basic terms, it’s the way we define the visibility of our properties and methods. • When you’re creating classes, you have to ask yourself what properties and methods can be accessed outside of the class. 3
  • 4. Access Levels Specifier Class SubClass all Private * Protected * * Public * * * 4
  • 5. Inheritance • In object-oriented programming, inheritance is when a class is based on another class, using the same implementation or specifying a new implementation to maintain the same behavior. • Such an inherited class is called a subclass of its parent class or super class. 5
  • 8. Local Development Server • If you have PHP installed locally and you would like to use PHP's built-in development server to serve your application, you may use the serve artisan command. • This command will start a development server at http://localhost:8000 • Of course, more robust local development options are available via Homestead and Valet. 8
  • 9. Front Controller • Like HTTP itself, the Request and Response objects are pretty simple. The hard part of building an application is writing what comes in between. In other words, the real work comes in writing the code that interprets the request information and creates the response • Your application probably does many things, like sending emails, handling form submissions, saving things to a database, rendering HTML pages and protecting content with security. How can you manage all of this and still keep your code organized and maintainable?
  • 10. Front Controller • Traditionally, applications were built so that each "page" of a site was its own physical file: A. index.php B. contact.php C. blog.php • There are several problems with this approach, including the inflexibility of the URLs (what if you wanted to change blog.php to news.php without breaking all of your links?) and the fact that each file must manually include some set of core files so that security, database connections and the "look" of the site can remain consistent.
  • 11. Front Controller • A much better solution is to use a front controller: a single PHP file that handles every request coming into your application. • Now, every request is handled exactly the same way. Instead of individual URLs executing different PHP files, the front controller is always executed, and the routing of different URLs to different parts of your application is done internally.
  • 12. Configuration Public Directory: After installing Laravel, you should configure your web server's document / web root to be the public directory. The index.php in this directory serves as the front controller for all HTTP requests entering your application. 12
  • 13. Configuration Config Directory: All of the configuration files for the Laravel framework are stored in the config directory. Application Key: The next thing you should do after installing Laravel is set your application key to a random string. If you installed Laravel via Composer or the Laravel installer, this key has already been set for you by the php artisan key:generate command. 13
  • 14. Configuration Configuration Caching: To give your application a speed boost, you should cache all of your configuration files into a single file using the config:cache Artisan command. This will combine all of the configuration options for your application into a single file which will be loaded quickly by the framework. 14
  • 15. Configuration Maintenance Mode: When your application is in maintenance mode, a custom view will be displayed for all requests into your application. This makes it easy to "disable" your application while it is updating or when you are performing maintenance. To enable maintenance mode, simply execute the down Artisan command: php artisan down. To disable maintenance mode, use the up command. 15
  • 16. Directory Structure The default Laravel application structure is intended to provide a great starting point for both large and small applications. Of course, you are free to organize your application however you like. Where is Models Directory? 16
  • 17. The Root Directory • App • Bootstrap • Config • Database • Public • Resources • Routes • Storage • Tests • Vendor 17
  • 18. 18 The App Directory The majority of your application is housed in the App directory. By default, this directory is namespaced under App and is autoloaded by Composer using the PSR-4 autoloading standard. The App directory contains a variety of additional directories such as Console, Http and Providers. Think of the Console and Http directories as providing an API into the core of your application. The HTTP protocol and CLI are both mechanisms to interact with your application, but do not actually contain application logic.
  • 19. Routing The most basic Laravel routes simply accept a URI and a Closure, providing a very simple and expressive method of defining routes: All Laravel routes are defined in your route files, which are located in the routes directory. 19
  • 23. Global Constraints If you would like a route parameter to always be constrained by a given regular expression, you may use the pattern method. You should define these patterns in the boot method of your RouteServiceProvider: 23
  • 26. 26 Controllers Instead of defining all of your request handling logic as Closures in route files, you may wish to organize this behavior using Controller classes. Controllers can group related request handling logic into a single class. Controllers are stored in the app/http/controllers directory.