SlideShare a Scribd company logo
whoami 
• Ahmad Shah Hafizan Hamidin 
• 27 years old 
• Been developing for > 7 years 
• Laravel & Orchestra fanboy 
• https://www.github.com/ahmadshah 
• @penjajah 
• kuasamalaya
So What is Laravel?
+ +
Why so many Laravel? 
laravel/laravel! 
The framework structure and boilerplate codes 
! 
laravel/framework! 
The core of laravel framework or the kernel 
! 
Illuminate 
The namespace for every laravel framework 
components!
What do we need? 
• A webserver (Apache2/NGINX) 
• PHP 5.4 or above 
• Database engines (MySQL/PostgreSQL/MSSQL) 
• PHP mcrypt extension 
• Composer
Composer! 
• Remember PEAR? 
• Awesome PHP package management 
• Making developer lives easier 
• Manage application dependencies 
• http://getcomposer.org/ 
• http://packagist.com/
How to get Laravel?! 
via Laravel installer! 
> composer global require “laravel/installer=~1.1” 
> laravel new my-application 
! 
via Composer! 
> composer create-project laravel/laravel my-application
Laravel Setup 
• Make app/storage directory writable 
• Update public/.htaccess if you are using alias 
• Update app/config/database.php to connect 
to your database
M V C 
Eloquent, Blade and Controller
Laravel Routes 
• Handles the HTTP requests 
• GET, POST, PUT, PATCH, DELETE 
• All application routes are defined inside 
app/routes.php 
• Can accept Closures or controller 
namespace
Laravel Routes 
Route with Closure! 
Route::get(‘foobar’, function () { 
return ‘Welcome to FooBar!’; 
}); 
! 
Route with Controller! 
Route::get(‘foobar’, ‘FoobarController@index’);
Laravel Controllers 
• Handles the HTTP requests 
• GET, POST, PUT, PATCH, DELETE 
• Controllers are kept under app/controllers 
• Laravel naming convention: FoobarController 
• Extends IlluminateRoutingController class
Laravel Resourceful 
Controllers 
• Handles the HTTP requests 
• GET, POST, PUT, PATCH, DELETE 
• Predefine controller methods to handle 
the HTTP verbs 
• index, show, create, store, edit, 
update, and destroy
Laravel Resourceful! 
Controllers 
Route with Resource Controller! 
Route::resource(‘foobar’, ‘FoobarController’);
Laravel Views 
• The presentation layer of an application 
• Can accept either vanilla PHP or Blade 
files 
• View files are located under app/views 
directory 
• Can accept array arguments
Laravel Views 
Route with view! 
Route::get(‘foobar’, function () { 
return View::make(‘foobar’); 
});
Laravel Blade
Laravel Blade 
• Laravel default templating engine 
• Files need to use .blade.php extension 
• Driven by inheritance and sections 
• Extensible for adding new custom control 
structures
Laravel Blade 
Master layout! 
<!doctype html> 
… 
<body> 
@yield(‘content’) 
</body> 
</html> 
! 
Child layout! 
@extends(‘layout.master’) 
@section(‘content’) 
… 
@stop
Laravel Eloquent 
• Laravel ORM component 
• Simple ActiveRecord implementation 
• Each tables can be represented with a 
“Model” file 
• Model files are located under app/models 
directory 
• Extends IlluminateDatabaseEloquentModel 
class
Laravel Fluent 
• Laravel SQL query builder component 
• Write SQL query in a more elegant and readable 
way
Laravel Filters 
• Control the behaviour of a route 
• Process request before or after 
• Filters are located inside app/filters.php 
• Can be attached directly to route or controller 
• Can be in either Closure or filter class
Laravel Auth 
• Laravel user authentication component 
• Provide a basic functionalities to authenticate users 
• Does not come with ACL / RBAC 
• Utilizes app/models/User.php 
• Laravel does not come with a user table by default
Tinkering with the artisan
Laravel Artisan 
• Laravel CLI 
• Uses the Symfony Console component 
• Manage table migrations, seed tables, 
create resourceful controllers and many more 
• Developer best friend!
Service Providers & Facades
SOLID Principles 
Single Responsibility Principle! 
a class should have only one responsibility 
! 
Open/Closed Principle! 
open for extension and closed for modification 
! 
Liskov Substitution Principle 
Subtypes must be substitutable for their base types!
SOLID Principles 
Interface Segregation Principle! 
many client-specific interfaces are better 
! 
Dependency Inversion Principle! 
depends on abstraction 
! 
!
Laravel IOC 
• Inversion Of Control 
• Manages class dependencies 
• Based on dependency injection method 
• Dependencies are injected at run-time 
• Allowing dependencies to be easily swapped
Laravel Service Providers 
• Act like a component bootstrap 
• Group related IoC registrations in one place 
• Can also run other functionalities like 
artisan commands
Laravel Facades 
• Provide static interfaces to classes 
• Classes are resolved via IoC containers 
• Laravel is full with facades such as View, 
Cache, Config and others
Laravel Workbench 
• A tool to help develop laravel based components 
• Scaffold the necessary boilerplates 
• We do not commit/ship workbench directory

More Related Content

What's hot

Laravel
LaravelLaravel
Laravel
tanveerkhan62
 
Laravel overview
Laravel overviewLaravel overview
Laravel overview
Obinna Akunne
 
laravel.pptx
laravel.pptxlaravel.pptx
laravel.pptx
asif290119
 
Introduction to the Web API
Introduction to the Web APIIntroduction to the Web API
Introduction to the Web API
Brad Genereaux
 
Web Development with Laravel 5
Web Development with Laravel 5Web Development with Laravel 5
Web Development with Laravel 5
Soheil Khodayari
 
Laravel presentation
Laravel presentationLaravel presentation
Laravel presentation
Toufiq Mahmud
 
Laravel Eloquent ORM
Laravel Eloquent ORMLaravel Eloquent ORM
Laravel Eloquent ORM
Ba Thanh Huynh
 
REST API and CRUD
REST API and CRUDREST API and CRUD
REST API and CRUD
Prem Sanil
 
An Introduction To REST API
An Introduction To REST APIAn Introduction To REST API
An Introduction To REST API
Aniruddh Bhilvare
 
Web api
Web apiWeb api
Lecture 2_ Intro to laravel.pptx
Lecture 2_ Intro to laravel.pptxLecture 2_ Intro to laravel.pptx
Lecture 2_ Intro to laravel.pptx
SaziaRahman
 
Maven Introduction
Maven IntroductionMaven Introduction
Maven Introduction
Sandeep Chawla
 
Spring boot Introduction
Spring boot IntroductionSpring boot Introduction
Spring boot Introduction
Jeevesh Pandey
 
Angular tutorial
Angular tutorialAngular tutorial
Angular tutorial
Rohit Gupta
 
Spring boot
Spring bootSpring boot
Spring boot
sdeeg
 
Laravel
LaravelLaravel
Laravel
Dyuti Islam
 
Laravel tutorial
Laravel tutorialLaravel tutorial
Laravel tutorial
Broker IG
 
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
 
Laravel Presentation
Laravel PresentationLaravel Presentation
Laravel Presentation
REZAUL KARIM REFATH
 
Introduction to Spring Boot
Introduction to Spring BootIntroduction to Spring Boot
Introduction to Spring Boot
Purbarun Chakrabarti
 

What's hot (20)

Laravel
LaravelLaravel
Laravel
 
Laravel overview
Laravel overviewLaravel overview
Laravel overview
 
laravel.pptx
laravel.pptxlaravel.pptx
laravel.pptx
 
Introduction to the Web API
Introduction to the Web APIIntroduction to the Web API
Introduction to the Web API
 
Web Development with Laravel 5
Web Development with Laravel 5Web Development with Laravel 5
Web Development with Laravel 5
 
Laravel presentation
Laravel presentationLaravel presentation
Laravel presentation
 
Laravel Eloquent ORM
Laravel Eloquent ORMLaravel Eloquent ORM
Laravel Eloquent ORM
 
REST API and CRUD
REST API and CRUDREST API and CRUD
REST API and CRUD
 
An Introduction To REST API
An Introduction To REST APIAn Introduction To REST API
An Introduction To REST API
 
Web api
Web apiWeb api
Web api
 
Lecture 2_ Intro to laravel.pptx
Lecture 2_ Intro to laravel.pptxLecture 2_ Intro to laravel.pptx
Lecture 2_ Intro to laravel.pptx
 
Maven Introduction
Maven IntroductionMaven Introduction
Maven Introduction
 
Spring boot Introduction
Spring boot IntroductionSpring boot Introduction
Spring boot Introduction
 
Angular tutorial
Angular tutorialAngular tutorial
Angular tutorial
 
Spring boot
Spring bootSpring boot
Spring boot
 
Laravel
LaravelLaravel
Laravel
 
Laravel tutorial
Laravel tutorialLaravel tutorial
Laravel tutorial
 
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
 
Laravel Presentation
Laravel PresentationLaravel Presentation
Laravel Presentation
 
Introduction to Spring Boot
Introduction to Spring BootIntroduction to Spring Boot
Introduction to Spring Boot
 

Similar to Laravel Introduction

Object Oriented Programming with Laravel - Session 2
Object Oriented Programming with Laravel - Session 2Object Oriented Programming with Laravel - Session 2
Object Oriented Programming with Laravel - Session 2
Shahrzad Peyman
 
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
 
PHP Laravel Framework'üne Dalış
PHP Laravel Framework'üne DalışPHP Laravel Framework'üne Dalış
PHP Laravel Framework'üne Dalış
emirkarsiyakali
 
Introduction to Laravel
Introduction to LaravelIntroduction to Laravel
Introduction to Laravel
Eli Wheaton
 
Laravel
LaravelLaravel
Laravel
Himani gajjar
 
Chef, Vagrant and Friends
Chef, Vagrant and FriendsChef, Vagrant and Friends
Chef, Vagrant and Friends
Ben McRae
 
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
 
Lecture11_LaravelGetStarted_SPring2023.pdf
Lecture11_LaravelGetStarted_SPring2023.pdfLecture11_LaravelGetStarted_SPring2023.pdf
Lecture11_LaravelGetStarted_SPring2023.pdf
ShaimaaMohamedGalal
 
Adventures in Laravel 5 SunshinePHP 2016 Tutorial
Adventures in Laravel 5 SunshinePHP 2016 TutorialAdventures in Laravel 5 SunshinePHP 2016 Tutorial
Adventures in Laravel 5 SunshinePHP 2016 Tutorial
Joe Ferguson
 
PLAT-8 Spring Web Scripts and Spring Surf
PLAT-8 Spring Web Scripts and Spring SurfPLAT-8 Spring Web Scripts and Spring Surf
PLAT-8 Spring Web Scripts and Spring Surf
Alfresco Software
 
How to Install Laravel 5.7
How to Install Laravel 5.7How to Install Laravel 5.7
How to Install Laravel 5.7
Shubham Sunny
 
Apache Tutorial
Apache TutorialApache Tutorial
Apache Tutorial
Guru99
 
Laravel 4 presentation
Laravel 4 presentationLaravel 4 presentation
Laravel 4 presentation
Abu Saleh Muhammad Shaon
 
Getting started with laravel
Getting started with laravelGetting started with laravel
Getting started with laravel
Advance Idea Infotech
 
Frequently Asked Questions About Laravel
Frequently Asked Questions About LaravelFrequently Asked Questions About Laravel
Frequently Asked Questions About Laravel
AResourcePool
 
The First Class Integration of Solr with Hadoop
The First Class Integration of Solr with HadoopThe First Class Integration of Solr with Hadoop
The First Class Integration of Solr with Hadoop
lucenerevolution
 
PLAT-7 Spring Web Scripts and Spring Surf
PLAT-7 Spring Web Scripts and Spring SurfPLAT-7 Spring Web Scripts and Spring Surf
PLAT-7 Spring Web Scripts and Spring Surf
Alfresco Software
 
PLAT-7 Spring Web Scripts and Spring Surf
PLAT-7 Spring Web Scripts and Spring SurfPLAT-7 Spring Web Scripts and Spring Surf
PLAT-7 Spring Web Scripts and Spring Surf
Alfresco Software
 
ReactPHP + Symfony
ReactPHP + SymfonyReactPHP + Symfony
ReactPHP + Symfony
David Bergunder
 

Similar to Laravel Introduction (20)

Object Oriented Programming with Laravel - Session 2
Object Oriented Programming with Laravel - Session 2Object Oriented Programming with Laravel - Session 2
Object Oriented Programming with Laravel - Session 2
 
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
 
PHP Laravel Framework'üne Dalış
PHP Laravel Framework'üne DalışPHP Laravel Framework'üne Dalış
PHP Laravel Framework'üne Dalış
 
Introduction to Laravel
Introduction to LaravelIntroduction to Laravel
Introduction to Laravel
 
Laravel
LaravelLaravel
Laravel
 
Chef, Vagrant and Friends
Chef, Vagrant and FriendsChef, Vagrant and Friends
Chef, Vagrant and Friends
 
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)
 
Lecture11_LaravelGetStarted_SPring2023.pdf
Lecture11_LaravelGetStarted_SPring2023.pdfLecture11_LaravelGetStarted_SPring2023.pdf
Lecture11_LaravelGetStarted_SPring2023.pdf
 
Laravel Meetup
Laravel MeetupLaravel Meetup
Laravel Meetup
 
Adventures in Laravel 5 SunshinePHP 2016 Tutorial
Adventures in Laravel 5 SunshinePHP 2016 TutorialAdventures in Laravel 5 SunshinePHP 2016 Tutorial
Adventures in Laravel 5 SunshinePHP 2016 Tutorial
 
PLAT-8 Spring Web Scripts and Spring Surf
PLAT-8 Spring Web Scripts and Spring SurfPLAT-8 Spring Web Scripts and Spring Surf
PLAT-8 Spring Web Scripts and Spring Surf
 
How to Install Laravel 5.7
How to Install Laravel 5.7How to Install Laravel 5.7
How to Install Laravel 5.7
 
Apache Tutorial
Apache TutorialApache Tutorial
Apache Tutorial
 
Laravel 4 presentation
Laravel 4 presentationLaravel 4 presentation
Laravel 4 presentation
 
Getting started with laravel
Getting started with laravelGetting started with laravel
Getting started with laravel
 
Frequently Asked Questions About Laravel
Frequently Asked Questions About LaravelFrequently Asked Questions About Laravel
Frequently Asked Questions About Laravel
 
The First Class Integration of Solr with Hadoop
The First Class Integration of Solr with HadoopThe First Class Integration of Solr with Hadoop
The First Class Integration of Solr with Hadoop
 
PLAT-7 Spring Web Scripts and Spring Surf
PLAT-7 Spring Web Scripts and Spring SurfPLAT-7 Spring Web Scripts and Spring Surf
PLAT-7 Spring Web Scripts and Spring Surf
 
PLAT-7 Spring Web Scripts and Spring Surf
PLAT-7 Spring Web Scripts and Spring SurfPLAT-7 Spring Web Scripts and Spring Surf
PLAT-7 Spring Web Scripts and Spring Surf
 
ReactPHP + Symfony
ReactPHP + SymfonyReactPHP + Symfony
ReactPHP + Symfony
 

Recently uploaded

The Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and SalesThe Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and Sales
Laura Byrne
 
How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...
Product School
 
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Thierry Lestable
 
UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4
DianaGray10
 
Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*
Frank van Harmelen
 
Essentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with ParametersEssentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with Parameters
Safe Software
 
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
Product School
 
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Ramesh Iyer
 
DevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA ConnectDevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA Connect
Kari Kakkonen
 
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdfFIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance
 
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdfFIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance
 
GraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge GraphGraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge Graph
Guy Korland
 
Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !
KatiaHIMEUR1
 
Accelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish CachingAccelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish Caching
Thijs Feryn
 
Elevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object CalisthenicsElevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object Calisthenics
Dorra BARTAGUIZ
 
When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...
Elena Simperl
 
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 previewState of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
Prayukth K V
 
UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3
DianaGray10
 
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Albert Hoitingh
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
James Anderson
 

Recently uploaded (20)

The Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and SalesThe Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and Sales
 
How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...How world-class product teams are winning in the AI era by CEO and Founder, P...
How world-class product teams are winning in the AI era by CEO and Founder, P...
 
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
 
UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4
 
Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*
 
Essentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with ParametersEssentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with Parameters
 
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
 
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
 
DevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA ConnectDevOps and Testing slides at DASA Connect
DevOps and Testing slides at DASA Connect
 
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdfFIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
 
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdfFIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
 
GraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge GraphGraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge Graph
 
Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !
 
Accelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish CachingAccelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish Caching
 
Elevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object CalisthenicsElevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object Calisthenics
 
When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...
 
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 previewState of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
 
UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3UiPath Test Automation using UiPath Test Suite series, part 3
UiPath Test Automation using UiPath Test Suite series, part 3
 
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
 

Laravel Introduction

  • 1.
  • 2. whoami • Ahmad Shah Hafizan Hamidin • 27 years old • Been developing for > 7 years • Laravel & Orchestra fanboy • https://www.github.com/ahmadshah • @penjajah • kuasamalaya
  • 3. So What is Laravel?
  • 4. + +
  • 5. Why so many Laravel? laravel/laravel! The framework structure and boilerplate codes ! laravel/framework! The core of laravel framework or the kernel ! Illuminate The namespace for every laravel framework components!
  • 6. What do we need? • A webserver (Apache2/NGINX) • PHP 5.4 or above • Database engines (MySQL/PostgreSQL/MSSQL) • PHP mcrypt extension • Composer
  • 7. Composer! • Remember PEAR? • Awesome PHP package management • Making developer lives easier • Manage application dependencies • http://getcomposer.org/ • http://packagist.com/
  • 8. How to get Laravel?! via Laravel installer! > composer global require “laravel/installer=~1.1” > laravel new my-application ! via Composer! > composer create-project laravel/laravel my-application
  • 9.
  • 10. Laravel Setup • Make app/storage directory writable • Update public/.htaccess if you are using alias • Update app/config/database.php to connect to your database
  • 11. M V C Eloquent, Blade and Controller
  • 12. Laravel Routes • Handles the HTTP requests • GET, POST, PUT, PATCH, DELETE • All application routes are defined inside app/routes.php • Can accept Closures or controller namespace
  • 13. Laravel Routes Route with Closure! Route::get(‘foobar’, function () { return ‘Welcome to FooBar!’; }); ! Route with Controller! Route::get(‘foobar’, ‘FoobarController@index’);
  • 14. Laravel Controllers • Handles the HTTP requests • GET, POST, PUT, PATCH, DELETE • Controllers are kept under app/controllers • Laravel naming convention: FoobarController • Extends IlluminateRoutingController class
  • 15. Laravel Resourceful Controllers • Handles the HTTP requests • GET, POST, PUT, PATCH, DELETE • Predefine controller methods to handle the HTTP verbs • index, show, create, store, edit, update, and destroy
  • 16. Laravel Resourceful! Controllers Route with Resource Controller! Route::resource(‘foobar’, ‘FoobarController’);
  • 17. Laravel Views • The presentation layer of an application • Can accept either vanilla PHP or Blade files • View files are located under app/views directory • Can accept array arguments
  • 18. Laravel Views Route with view! Route::get(‘foobar’, function () { return View::make(‘foobar’); });
  • 20. Laravel Blade • Laravel default templating engine • Files need to use .blade.php extension • Driven by inheritance and sections • Extensible for adding new custom control structures
  • 21. Laravel Blade Master layout! <!doctype html> … <body> @yield(‘content’) </body> </html> ! Child layout! @extends(‘layout.master’) @section(‘content’) … @stop
  • 22. Laravel Eloquent • Laravel ORM component • Simple ActiveRecord implementation • Each tables can be represented with a “Model” file • Model files are located under app/models directory • Extends IlluminateDatabaseEloquentModel class
  • 23. Laravel Fluent • Laravel SQL query builder component • Write SQL query in a more elegant and readable way
  • 24. Laravel Filters • Control the behaviour of a route • Process request before or after • Filters are located inside app/filters.php • Can be attached directly to route or controller • Can be in either Closure or filter class
  • 25. Laravel Auth • Laravel user authentication component • Provide a basic functionalities to authenticate users • Does not come with ACL / RBAC • Utilizes app/models/User.php • Laravel does not come with a user table by default
  • 27.
  • 28. Laravel Artisan • Laravel CLI • Uses the Symfony Console component • Manage table migrations, seed tables, create resourceful controllers and many more • Developer best friend!
  • 30. SOLID Principles Single Responsibility Principle! a class should have only one responsibility ! Open/Closed Principle! open for extension and closed for modification ! Liskov Substitution Principle Subtypes must be substitutable for their base types!
  • 31. SOLID Principles Interface Segregation Principle! many client-specific interfaces are better ! Dependency Inversion Principle! depends on abstraction ! !
  • 32. Laravel IOC • Inversion Of Control • Manages class dependencies • Based on dependency injection method • Dependencies are injected at run-time • Allowing dependencies to be easily swapped
  • 33. Laravel Service Providers • Act like a component bootstrap • Group related IoC registrations in one place • Can also run other functionalities like artisan commands
  • 34. Laravel Facades • Provide static interfaces to classes • Classes are resolved via IoC containers • Laravel is full with facades such as View, Cache, Config and others
  • 35. Laravel Workbench • A tool to help develop laravel based components • Scaffold the necessary boilerplates • We do not commit/ship workbench directory