SlideShare a Scribd company logo
Laravel Level 0
The Introduction to Laravel
By Spicydog (31-10-2016)
Agenda
● Lecturer introduce
● PHP in Brief
○ PHP Basic (Variable, Controls, Function)
○ PHP Intermediate (OOP)
● Web Application Development World
○ CMS (Content Management System)
○ Application Frameworks
● Introduction to Laravel
○ What is Laravel?
○ Why Laravel?
○ Prerequisites
● Development Environment
● Workshop & Assignments
● Simply a full stack developer since high school
● Graduated MS from CPE@KMUTT
● Do research but still love application developments
● Dev everything from web to Android to iOS
● Feel free to discuss with me, I love knowledge sharing!
Hello! it’s me, Spicydog!
A Quick Review for PHP
● Established in 1995
● Zend Technologies and PHP communities
● Most popular version: 5.6
● Most recent version: 7.1 (recommend 7.0)
● PHP is a SCRIPT Language
● Designed for web development (I am good at string things)
● Almost dominate the internet,
supported by most hosting,
has so many CMS and frameworks
PHP is everywhere and now here!
Let’s Rock with PHP Variable
$ for variable
$a = “1” // string(1) "1"
$b = ’1’ // string(1) "1"
$c = 1 // int(1)
$d = 1.0 // float(1)
var_dump() for variable information
var_dump($a+$b); // int(2)
var_dump($a.$b); // string(2) "11"
var_dump($a+$c); // int(2)
var_dump($c.$d); // string(2) "11"
var_dump($c+$d); // float(2)
So becareful!
PHP is dynamic type, it works most of the times but it always.
You must cast types with intval(), floatval(), and friends.. sometimes
'string' and "string" are NOT the same!
$a = 1;
$b = 2;
$c = 3;
echo '$a
$b
$c
';
echo '$an$bn$cn';
echo "$a
$b
$c
";
echo "$an$bn$cn";
$a
$b
$c
$an$bn$cn1
2
3
1
2
3
Controls in PHP are similar to C and Java
If..Else
if ($a) {}
else {}
For
for($i=0; $i<10; $i++;) {}
While
$i=0; while($i<10) {$i++;}
Do..While
$i=0; do{$i++;} while($i<10);
Switch
switch ($i) {
case 0: break;
default: break;
}
Functions in PHP are also similar to C and Java
function name($param1, $param2) {
return $param1 . $param2;
}
name(‘1’,’2’); // string(2) "12"
Class in PHP <?php
class Foo
{
public static $my_static = 'foo';
public function staticValue() {
return self::$my_static;
}
}
class Bar extends Foo
{
public function fooStatic() {
return parent::$my_static;
}
}
print Foo::$my_static . "n";
$foo = new Foo();
print $foo->staticValue() . "n";
print $foo->my_static . "n"; // Undefined "Property" my_static
print $foo::$my_static . "n";
$classname = 'Foo';
print $classname::$my_static . "n"; // As of PHP 5.3.0
print Bar::$my_static . "n";
$bar = new Bar();
print $bar->fooStatic() . "n";
?>
self for static
$this for object
:: call to static
-> call to object
http://php.net/manual/en/language.oop5.static.php
Web Application Development World
In web application development world, we..
Do it easy
Do it quick
Do it simple
Do it readable
Do it secure
Do it extendable
We try to use less money and time to have things done!
So we go for CMS and Frameworks
● CMS (Content Management System)
○ A web application for content management
○ Install and ready to go!
○ Work on most simple tasks
○ Not very flexible
● Application Framework
○ A template for application development
○ Pattern the code
○ Avoid reinvent the wheel
○ Easy and dev on top and flexible for most tasks
○ Require programming skills
Getting Started with Laravel
Laravel, a super productive PHP framework
● Laravel first launched in 2011
● Current version is 5.3
● Developed on top of Symfony
● Aims: fun, productive, clean, extendable
● Relatively bad in performance (but not that bad!)
Why Laravel?
● Easy to learn! (hopefully)
● Full of tools, ready for dev, tons of libraries
● We want our application to finish as fast as possible
● We want to work least
● We want our application easy to develop
● Our application is not user intensive
● Save time, save money, and done more things!
Say all of these in one word..
PRODUCTIVITY
But wait!! You have to know..
PHP Basic
PHP with DBMS
PHP OOP
PHP CLI
MVC
Composer
Artisan CLI
OMG
Don’t Worry!
I’m here to help you out :)
PHP CLI
CLI stands for Command Line Interface
Similar to Command Prompt and whatever Shell but this is PHP
Try this on your terminal! php -a
Are you using Windows? Good luck, help yourself! GOOGLE
Model-View-Controller
A primitive flow for software development
Client (Request) => Controller (Logic) => Model (Data Logic) =>
Controller (Login Again) => View (Display) => Client (Response)
Partitioning codes
by its functionality
Easy to maintain
This is a must-known
thing in any
software development
http://www.tutorialized.com/tutorial/Fundamentals-of-an-MVC-Framework/81946
Composer
The most popular dependency management tool in PHP
Get any libraries by typing in CLI
For example,
Install Laravel, we simply enter:
composer create-project --prefer-dist laravel/laravel blog
Add library to laravel we do:
composer require "laravelcollective/html":"^5.2.0"
Q: Where did I get these commands?
A: Google it man, they are on the website
https://getcomposer.org
Artisan CLI
Artisan is a PHP CLI Tool help you manage Laravel components
Simply go to Laravel root directory and type: php artisan
We are going to talk about this later since we are going to use it a lot!
Development Environment
Make sure you can run..
php from your command line
Otherwise, install PHP (we use PHP 5.6+)
composer from your command line
Otherwise, install Composer
Web Server on your computer
Recommend Apache for Rookie
You can use XAMPP for Windows or MAMP for Mac or LAMP for Linux
PHP IDE
I recommend PhpStorm, use your student status to claim a license
Git
We use Git here, you can use SourceTree if you want GUI client
Coding Style
In Laravel, we follow
PSR-2 Coding Style
Please follow this style =>
<?php
namespace VendorPackage;
use FooInterface;
use BarClass as Bar;
use OtherVendorOtherPackageBazClass;
class Foo extends Bar implements FooInterface
{
public function sampleMethod($a, $b = null)
{
if ($a === $b) {
bar();
} elseif ($a > $b) {
$foo->bar($arg1);
} else {
BazClass::bar($arg2, $arg3);
}
}
final public static function bar()
{
// method body
}
}
Workshop & Assignments
ROCK n’ LOAD
The most valuable skill is the skill to learn new things,
so here is your works have to make it done before next time
- Install development environment I have talked in last section
- Install your first Laravel Application
- Have a look at Directory Structure
- Try whatever you want
Extra!
- Wanna in advance? Go watch to Laracasts
- Free public cloud you can get from AWS Free Tier
Or claim free DigitalOcean credit from Github Student
Woo hoo!
No more slides, let’s rock!

More Related Content

What's hot

Laravel 5 In Depth
Laravel 5 In DepthLaravel 5 In Depth
Laravel 5 In DepthKirk Bushell
 
Knowing Laravel 5 : The most popular PHP framework
Knowing Laravel 5 : The most popular PHP frameworkKnowing Laravel 5 : The most popular PHP framework
Knowing Laravel 5 : The most popular PHP frameworkBukhori Aqid
 
Laravel Webcon 2015
Laravel Webcon 2015Laravel Webcon 2015
Laravel Webcon 2015Tim Bracken
 
Introduction to Laravel
Introduction to LaravelIntroduction to Laravel
Introduction to LaravelVin Lim
 
What's New In Laravel 5
What's New In Laravel 5What's New In Laravel 5
What's New In Laravel 5Darren Craig
 
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 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
 
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 ProjectsSam Dias
 
Laravel.IO A Use-Case Architecture
Laravel.IO A Use-Case ArchitectureLaravel.IO A Use-Case Architecture
Laravel.IO A Use-Case ArchitectureShawn McCool
 
All Aboard for Laravel 5.1
All Aboard for Laravel 5.1All Aboard for Laravel 5.1
All Aboard for Laravel 5.1Jason McCreary
 
Introduction to laravel framework
Introduction to laravel frameworkIntroduction to laravel framework
Introduction to laravel frameworkAhmad Fatoni
 
What's New in Laravel 5 (Laravel Meetup - 23th Apr 15, Yogyakarta, ID)
What's New in Laravel 5 (Laravel Meetup - 23th Apr 15, Yogyakarta, ID)What's New in Laravel 5 (Laravel Meetup - 23th Apr 15, Yogyakarta, ID)
What's New in Laravel 5 (Laravel Meetup - 23th Apr 15, Yogyakarta, ID)Roes Wibowo
 
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 TutorialJoe Ferguson
 

What's hot (20)

Laravel 5 In Depth
Laravel 5 In DepthLaravel 5 In Depth
Laravel 5 In Depth
 
Laravel ppt
Laravel pptLaravel ppt
Laravel ppt
 
Presentation laravel 5 4
Presentation laravel 5 4Presentation laravel 5 4
Presentation laravel 5 4
 
Intro to Laravel
Intro to LaravelIntro to Laravel
Intro to Laravel
 
Knowing Laravel 5 : The most popular PHP framework
Knowing Laravel 5 : The most popular PHP frameworkKnowing Laravel 5 : The most popular PHP framework
Knowing Laravel 5 : The most popular PHP framework
 
Workshop Laravel 5.2
Workshop Laravel 5.2Workshop Laravel 5.2
Workshop Laravel 5.2
 
Laravel Webcon 2015
Laravel Webcon 2015Laravel Webcon 2015
Laravel Webcon 2015
 
Laravel Eloquent ORM
Laravel Eloquent ORMLaravel Eloquent ORM
Laravel Eloquent ORM
 
Introduction to Laravel
Introduction to LaravelIntroduction to Laravel
Introduction to Laravel
 
What's New In Laravel 5
What's New In Laravel 5What's New In Laravel 5
What's New In Laravel 5
 
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 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...
 
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
 
Laravel.IO A Use-Case Architecture
Laravel.IO A Use-Case ArchitectureLaravel.IO A Use-Case Architecture
Laravel.IO A Use-Case Architecture
 
All Aboard for Laravel 5.1
All Aboard for Laravel 5.1All Aboard for Laravel 5.1
All Aboard for Laravel 5.1
 
Introduction to laravel framework
Introduction to laravel frameworkIntroduction to laravel framework
Introduction to laravel framework
 
What's New in Laravel 5 (Laravel Meetup - 23th Apr 15, Yogyakarta, ID)
What's New in Laravel 5 (Laravel Meetup - 23th Apr 15, Yogyakarta, ID)What's New in Laravel 5 (Laravel Meetup - 23th Apr 15, Yogyakarta, ID)
What's New in Laravel 5 (Laravel Meetup - 23th Apr 15, Yogyakarta, ID)
 
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
 
Laravel overview
Laravel overviewLaravel overview
Laravel overview
 
Laravel Introduction
Laravel IntroductionLaravel Introduction
Laravel Introduction
 

Similar to Laravel level 0 (introduction)

Similar to Laravel level 0 (introduction) (20)

php basics
php basicsphp basics
php basics
 
PHP - Introduction to PHP Fundamentals
PHP -  Introduction to PHP FundamentalsPHP -  Introduction to PHP Fundamentals
PHP - Introduction to PHP Fundamentals
 
PHP
PHPPHP
PHP
 
WT_PHP_PART1.pdf
WT_PHP_PART1.pdfWT_PHP_PART1.pdf
WT_PHP_PART1.pdf
 
Prersentation
PrersentationPrersentation
Prersentation
 
Upstate CSCI 450 PHP Chapters 5, 12, 13
Upstate CSCI 450 PHP Chapters 5, 12, 13Upstate CSCI 450 PHP Chapters 5, 12, 13
Upstate CSCI 450 PHP Chapters 5, 12, 13
 
Winter%200405%20-%20Beginning%20PHP
Winter%200405%20-%20Beginning%20PHPWinter%200405%20-%20Beginning%20PHP
Winter%200405%20-%20Beginning%20PHP
 
Winter%200405%20-%20Beginning%20PHP
Winter%200405%20-%20Beginning%20PHPWinter%200405%20-%20Beginning%20PHP
Winter%200405%20-%20Beginning%20PHP
 
Php mysql
Php mysqlPhp mysql
Php mysql
 
Php tutorial(w3schools)
Php tutorial(w3schools)Php tutorial(w3schools)
Php tutorial(w3schools)
 
Php tutorialw3schools
Php tutorialw3schoolsPhp tutorialw3schools
Php tutorialw3schools
 
Php
PhpPhp
Php
 
Lecture8
Lecture8Lecture8
Lecture8
 
1336333055 php tutorial_from_beginner_to_master
1336333055 php tutorial_from_beginner_to_master1336333055 php tutorial_from_beginner_to_master
1336333055 php tutorial_from_beginner_to_master
 
PHP from soup to nuts Course Deck
PHP from soup to nuts Course DeckPHP from soup to nuts Course Deck
PHP from soup to nuts Course Deck
 
Introduction to PHP - Basics of PHP
Introduction to PHP - Basics of PHPIntroduction to PHP - Basics of PHP
Introduction to PHP - Basics of PHP
 
CLI, the other SAPI
CLI, the other SAPICLI, the other SAPI
CLI, the other SAPI
 
PHP Lesson
PHP LessonPHP Lesson
PHP Lesson
 
PHP Jump Start
PHP Jump StartPHP Jump Start
PHP Jump Start
 
Phphacku iitd
Phphacku iitdPhphacku iitd
Phphacku iitd
 

Recently uploaded

Breaking the Code : A Guide to WhatsApp Business API.pdf
Breaking the Code : A Guide to WhatsApp Business API.pdfBreaking the Code : A Guide to WhatsApp Business API.pdf
Breaking the Code : A Guide to WhatsApp Business API.pdfMeon Technology
 
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital TransformationWSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital TransformationWSO2
 
SOCRadar Research Team: Latest Activities of IntelBroker
SOCRadar Research Team: Latest Activities of IntelBrokerSOCRadar Research Team: Latest Activities of IntelBroker
SOCRadar Research Team: Latest Activities of IntelBrokerSOCRadar
 
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdfDominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdfAMB-Review
 
Prosigns: Transforming Business with Tailored Technology Solutions
Prosigns: Transforming Business with Tailored Technology SolutionsProsigns: Transforming Business with Tailored Technology Solutions
Prosigns: Transforming Business with Tailored Technology SolutionsProsigns
 
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...informapgpstrackings
 
GlobusWorld 2024 Opening Keynote session
GlobusWorld 2024 Opening Keynote sessionGlobusWorld 2024 Opening Keynote session
GlobusWorld 2024 Opening Keynote sessionGlobus
 
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 2024Ortus Solutions, Corp
 
Accelerate Enterprise Software Engineering with Platformless
Accelerate Enterprise Software Engineering with PlatformlessAccelerate Enterprise Software Engineering with Platformless
Accelerate Enterprise Software Engineering with PlatformlessWSO2
 
GraphAware - Transforming policing with graph-based intelligence analysis
GraphAware - Transforming policing with graph-based intelligence analysisGraphAware - Transforming policing with graph-based intelligence analysis
GraphAware - Transforming policing with graph-based intelligence analysisNeo4j
 
Large Language Models and the End of Programming
Large Language Models and the End of ProgrammingLarge Language Models and the End of Programming
Large Language Models and the End of ProgrammingMatt Welsh
 
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERRORTROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERRORTier1 app
 
Understanding Globus Data Transfers with NetSage
Understanding Globus Data Transfers with NetSageUnderstanding Globus Data Transfers with NetSage
Understanding Globus Data Transfers with NetSageGlobus
 
De mooiste recreatieve routes ontdekken met RouteYou en FME
De mooiste recreatieve routes ontdekken met RouteYou en FMEDe mooiste recreatieve routes ontdekken met RouteYou en FME
De mooiste recreatieve routes ontdekken met RouteYou en FMEJelle | Nordend
 
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
 
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
 
Advanced Flow Concepts Every Developer Should Know
Advanced Flow Concepts Every Developer Should KnowAdvanced Flow Concepts Every Developer Should Know
Advanced Flow Concepts Every Developer Should KnowPeter Caitens
 
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...Anthony Dahanne
 
AI/ML Infra Meetup | Improve Speed and GPU Utilization for Model Training & S...
AI/ML Infra Meetup | Improve Speed and GPU Utilization for Model Training & S...AI/ML Infra Meetup | Improve Speed and GPU Utilization for Model Training & S...
AI/ML Infra Meetup | Improve Speed and GPU Utilization for Model Training & S...Alluxio, Inc.
 
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...Juraj Vysvader
 

Recently uploaded (20)

Breaking the Code : A Guide to WhatsApp Business API.pdf
Breaking the Code : A Guide to WhatsApp Business API.pdfBreaking the Code : A Guide to WhatsApp Business API.pdf
Breaking the Code : A Guide to WhatsApp Business API.pdf
 
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital TransformationWSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
 
SOCRadar Research Team: Latest Activities of IntelBroker
SOCRadar Research Team: Latest Activities of IntelBrokerSOCRadar Research Team: Latest Activities of IntelBroker
SOCRadar Research Team: Latest Activities of IntelBroker
 
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdfDominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
 
Prosigns: Transforming Business with Tailored Technology Solutions
Prosigns: Transforming Business with Tailored Technology SolutionsProsigns: Transforming Business with Tailored Technology Solutions
Prosigns: Transforming Business with Tailored Technology Solutions
 
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
 
GlobusWorld 2024 Opening Keynote session
GlobusWorld 2024 Opening Keynote sessionGlobusWorld 2024 Opening Keynote session
GlobusWorld 2024 Opening Keynote session
 
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
 
Accelerate Enterprise Software Engineering with Platformless
Accelerate Enterprise Software Engineering with PlatformlessAccelerate Enterprise Software Engineering with Platformless
Accelerate Enterprise Software Engineering with Platformless
 
GraphAware - Transforming policing with graph-based intelligence analysis
GraphAware - Transforming policing with graph-based intelligence analysisGraphAware - Transforming policing with graph-based intelligence analysis
GraphAware - Transforming policing with graph-based intelligence analysis
 
Large Language Models and the End of Programming
Large Language Models and the End of ProgrammingLarge Language Models and the End of Programming
Large Language Models and the End of Programming
 
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERRORTROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
 
Understanding Globus Data Transfers with NetSage
Understanding Globus Data Transfers with NetSageUnderstanding Globus Data Transfers with NetSage
Understanding Globus Data Transfers with NetSage
 
De mooiste recreatieve routes ontdekken met RouteYou en FME
De mooiste recreatieve routes ontdekken met RouteYou en FMEDe mooiste recreatieve routes ontdekken met RouteYou en FME
De mooiste recreatieve routes ontdekken met RouteYou en FME
 
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...
 
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...
 
Advanced Flow Concepts Every Developer Should Know
Advanced Flow Concepts Every Developer Should KnowAdvanced Flow Concepts Every Developer Should Know
Advanced Flow Concepts Every Developer Should Know
 
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
 
AI/ML Infra Meetup | Improve Speed and GPU Utilization for Model Training & S...
AI/ML Infra Meetup | Improve Speed and GPU Utilization for Model Training & S...AI/ML Infra Meetup | Improve Speed and GPU Utilization for Model Training & S...
AI/ML Infra Meetup | Improve Speed and GPU Utilization for Model Training & S...
 
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
 

Laravel level 0 (introduction)

  • 1. Laravel Level 0 The Introduction to Laravel By Spicydog (31-10-2016)
  • 2. Agenda ● Lecturer introduce ● PHP in Brief ○ PHP Basic (Variable, Controls, Function) ○ PHP Intermediate (OOP) ● Web Application Development World ○ CMS (Content Management System) ○ Application Frameworks ● Introduction to Laravel ○ What is Laravel? ○ Why Laravel? ○ Prerequisites ● Development Environment ● Workshop & Assignments
  • 3. ● Simply a full stack developer since high school ● Graduated MS from CPE@KMUTT ● Do research but still love application developments ● Dev everything from web to Android to iOS ● Feel free to discuss with me, I love knowledge sharing! Hello! it’s me, Spicydog!
  • 4. A Quick Review for PHP
  • 5. ● Established in 1995 ● Zend Technologies and PHP communities ● Most popular version: 5.6 ● Most recent version: 7.1 (recommend 7.0) ● PHP is a SCRIPT Language ● Designed for web development (I am good at string things) ● Almost dominate the internet, supported by most hosting, has so many CMS and frameworks PHP is everywhere and now here!
  • 6. Let’s Rock with PHP Variable $ for variable $a = “1” // string(1) "1" $b = ’1’ // string(1) "1" $c = 1 // int(1) $d = 1.0 // float(1) var_dump() for variable information var_dump($a+$b); // int(2) var_dump($a.$b); // string(2) "11" var_dump($a+$c); // int(2) var_dump($c.$d); // string(2) "11" var_dump($c+$d); // float(2) So becareful! PHP is dynamic type, it works most of the times but it always. You must cast types with intval(), floatval(), and friends.. sometimes
  • 7. 'string' and "string" are NOT the same! $a = 1; $b = 2; $c = 3; echo '$a $b $c '; echo '$an$bn$cn'; echo "$a $b $c "; echo "$an$bn$cn"; $a $b $c $an$bn$cn1 2 3 1 2 3
  • 8. Controls in PHP are similar to C and Java If..Else if ($a) {} else {} For for($i=0; $i<10; $i++;) {} While $i=0; while($i<10) {$i++;} Do..While $i=0; do{$i++;} while($i<10); Switch switch ($i) { case 0: break; default: break; }
  • 9. Functions in PHP are also similar to C and Java function name($param1, $param2) { return $param1 . $param2; } name(‘1’,’2’); // string(2) "12"
  • 10. Class in PHP <?php class Foo { public static $my_static = 'foo'; public function staticValue() { return self::$my_static; } } class Bar extends Foo { public function fooStatic() { return parent::$my_static; } } print Foo::$my_static . "n"; $foo = new Foo(); print $foo->staticValue() . "n"; print $foo->my_static . "n"; // Undefined "Property" my_static print $foo::$my_static . "n"; $classname = 'Foo'; print $classname::$my_static . "n"; // As of PHP 5.3.0 print Bar::$my_static . "n"; $bar = new Bar(); print $bar->fooStatic() . "n"; ?> self for static $this for object :: call to static -> call to object http://php.net/manual/en/language.oop5.static.php
  • 12. In web application development world, we.. Do it easy Do it quick Do it simple Do it readable Do it secure Do it extendable We try to use less money and time to have things done!
  • 13. So we go for CMS and Frameworks ● CMS (Content Management System) ○ A web application for content management ○ Install and ready to go! ○ Work on most simple tasks ○ Not very flexible ● Application Framework ○ A template for application development ○ Pattern the code ○ Avoid reinvent the wheel ○ Easy and dev on top and flexible for most tasks ○ Require programming skills
  • 15. Laravel, a super productive PHP framework ● Laravel first launched in 2011 ● Current version is 5.3 ● Developed on top of Symfony ● Aims: fun, productive, clean, extendable ● Relatively bad in performance (but not that bad!)
  • 16. Why Laravel? ● Easy to learn! (hopefully) ● Full of tools, ready for dev, tons of libraries ● We want our application to finish as fast as possible ● We want to work least ● We want our application easy to develop ● Our application is not user intensive ● Save time, save money, and done more things! Say all of these in one word.. PRODUCTIVITY
  • 17. But wait!! You have to know.. PHP Basic PHP with DBMS PHP OOP PHP CLI MVC Composer Artisan CLI OMG
  • 18. Don’t Worry! I’m here to help you out :)
  • 19. PHP CLI CLI stands for Command Line Interface Similar to Command Prompt and whatever Shell but this is PHP Try this on your terminal! php -a Are you using Windows? Good luck, help yourself! GOOGLE
  • 20. Model-View-Controller A primitive flow for software development Client (Request) => Controller (Logic) => Model (Data Logic) => Controller (Login Again) => View (Display) => Client (Response) Partitioning codes by its functionality Easy to maintain This is a must-known thing in any software development http://www.tutorialized.com/tutorial/Fundamentals-of-an-MVC-Framework/81946
  • 21. Composer The most popular dependency management tool in PHP Get any libraries by typing in CLI For example, Install Laravel, we simply enter: composer create-project --prefer-dist laravel/laravel blog Add library to laravel we do: composer require "laravelcollective/html":"^5.2.0" Q: Where did I get these commands? A: Google it man, they are on the website https://getcomposer.org
  • 22. Artisan CLI Artisan is a PHP CLI Tool help you manage Laravel components Simply go to Laravel root directory and type: php artisan We are going to talk about this later since we are going to use it a lot!
  • 24. Make sure you can run.. php from your command line Otherwise, install PHP (we use PHP 5.6+) composer from your command line Otherwise, install Composer Web Server on your computer Recommend Apache for Rookie You can use XAMPP for Windows or MAMP for Mac or LAMP for Linux PHP IDE I recommend PhpStorm, use your student status to claim a license Git We use Git here, you can use SourceTree if you want GUI client
  • 25. Coding Style In Laravel, we follow PSR-2 Coding Style Please follow this style => <?php namespace VendorPackage; use FooInterface; use BarClass as Bar; use OtherVendorOtherPackageBazClass; class Foo extends Bar implements FooInterface { public function sampleMethod($a, $b = null) { if ($a === $b) { bar(); } elseif ($a > $b) { $foo->bar($arg1); } else { BazClass::bar($arg2, $arg3); } } final public static function bar() { // method body } }
  • 27. ROCK n’ LOAD The most valuable skill is the skill to learn new things, so here is your works have to make it done before next time - Install development environment I have talked in last section - Install your first Laravel Application - Have a look at Directory Structure - Try whatever you want Extra! - Wanna in advance? Go watch to Laracasts - Free public cloud you can get from AWS Free Tier Or claim free DigitalOcean credit from Github Student
  • 28. Woo hoo! No more slides, let’s rock!