the php framework for web artisans. what is laravel? developed by taylor otwell web application...

12
THE PHP FRAMEWORK FOR WEB ARTISANS

Upload: karen-goodman

Post on 31-Dec-2015

214 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: THE PHP FRAMEWORK FOR WEB ARTISANS. What is Laravel? Developed by Taylor Otwell Web application framework Follows MVC design pattern Expressive syntax

THE PHP FRAMEWORK FOR WEB ARTISANS

Page 2: THE PHP FRAMEWORK FOR WEB ARTISANS. What is Laravel? Developed by Taylor Otwell Web application framework Follows MVC design pattern Expressive syntax

What is Laravel?

• Developed by Taylor Otwell• Web application framework• Follows MVC design pattern• Expressive syntax

Page 3: THE PHP FRAMEWORK FOR WEB ARTISANS. What is Laravel? Developed by Taylor Otwell Web application framework Follows MVC design pattern Expressive syntax

Why use Laravel

• Elegant syntax• Utilizes the latest PHP features• Well documented• CLI Tools• Eloquent ORM• Fun to develop with

Page 4: THE PHP FRAMEWORK FOR WEB ARTISANS. What is Laravel? Developed by Taylor Otwell Web application framework Follows MVC design pattern Expressive syntax

Closures

• Introduced in PHP 5.3• Anonymous functions

Route::get(‘login’, function() { return View::make(‘users/login’);});

Page 5: THE PHP FRAMEWORK FOR WEB ARTISANS. What is Laravel? Developed by Taylor Otwell Web application framework Follows MVC design pattern Expressive syntax

The Syntactic Sugar

• Easy to understand• Expressiveness and elegance

Auth::check()Input::get()User::all()

Page 6: THE PHP FRAMEWORK FOR WEB ARTISANS. What is Laravel? Developed by Taylor Otwell Web application framework Follows MVC design pattern Expressive syntax

The MVC Layers

• Eloquent ORM• Blade Engine• Controller

Page 7: THE PHP FRAMEWORK FOR WEB ARTISANS. What is Laravel? Developed by Taylor Otwell Web application framework Follows MVC design pattern Expressive syntax

Eloquent ORM• Easy to use

class Feed extends Eloquent { public function user() { return $this->belongsTo('User'); }

public function moment() { return $this->created_at->diffForHumans(); }

}

Page 8: THE PHP FRAMEWORK FOR WEB ARTISANS. What is Laravel? Developed by Taylor Otwell Web application framework Follows MVC design pattern Expressive syntax

Eloquent ORM• Example queries:

Book::all()Book::find(1)Book::where(‘name’, ‘=‘, ‘John Doe’)

• Insert / Update$b = new Book();$b->title = ‘Intro to Laravel’;$b->description = ‘This book rocks’;$b->save;

$b = Book::find(2);$b->title = ‘Advanced Laravel’;$b->save();

Page 9: THE PHP FRAMEWORK FOR WEB ARTISANS. What is Laravel? Developed by Taylor Otwell Web application framework Follows MVC design pattern Expressive syntax

Eloquent ORM

• Relationship mapping

public function user(){

return $this->belongsTo(‘Author’, ‘authro_id’);{

Page 10: THE PHP FRAMEWORK FOR WEB ARTISANS. What is Laravel? Developed by Taylor Otwell Web application framework Follows MVC design pattern Expressive syntax

Blade Engine

• Stock templating engine for laravel• Supports template inheritance and sections

<html> <head> <title>@yield('page_title')</title> </head> <body> Some text @yield('content') </body>

</html>

Page 11: THE PHP FRAMEWORK FOR WEB ARTISANS. What is Laravel? Developed by Taylor Otwell Web application framework Follows MVC design pattern Expressive syntax

Blade Engine

@extends(‘layout’)

@section(‘page title’, ‘Test Page’)@section(‘content’)

Hello user!@stop

Page 12: THE PHP FRAMEWORK FOR WEB ARTISANS. What is Laravel? Developed by Taylor Otwell Web application framework Follows MVC design pattern Expressive syntax

Bootstrap

The most popular front-end framework for developing responsive, mobile first projects on

the web.