
Chris van Daele / 06.02.2015 / QuestBack, Köln Laravel 5 Framework The PHP Framework for Web Artisans „Simplicity is the essence of happiness.“ - Cedric Bledsoe Chris van Daele - Introduction to Laravel 5 Chris van Daele - Introduction to Laravel 5 Was bisher geschah ❖ 06/2011: Laravel 1 ❖ 11/2011: Laravel 2 ❖ 02/2012: Laravel 3 ❖ 05/2013: Laravel 4 ❖ 02/2015: Laravel 5 (4.3) Taylor Otwell Chris van Daele - Introduction to Laravel 5 Larawhat? Das Ecosystem. laravel/laravel laravel/homestead Framework Struktur und Demo Code Lokale Laravel Entwicklungsumgebung laravel/framework Forge Laravel Kernel Deploymentsystem in der Cloud Illuminate Laracasts Laravel Komponenten Screencasts. It‘s amazing! Namespace innerhalb des Frameworks Chris van Daele - Introduction to Laravel 5 Features, Features, Features! Expressive, beautiful Syntax Version 5 Features: Eloquent ORM (ActiveRecord Implementation) Illuminate Contracts Routing (Restful) Middleware (Filter) Command Bus IoC Container Flysystem (Local, Amazon S3, Rackspace) Dependeny Injection Elixir (Gulp Api Wrapper) Migrations, Schema Builder & Seeds Socialite (OAuth) Authentication Scheduler Testable Validation CLI Chris van Daele - Introduction to Laravel 5 Symfony meets Laravel symfony/console symfony/process symfony/debug symfony/routing symfony/finder symfony/security-core symfony/http-foundation symfony/translation symfony/finder symfony/var-dumper symfony/http-kernel Chris van Daele - Introduction to Laravel 5 Thats not all – there is even more! monolog/monolog league/flysystem nesbost/carbon swiftmailer/swiftmailer vlucas/phpdotenv ircmaxel/password-compat Chris van Daele - Introduction to Laravel 5 Illuminaten! Auth Encryption Queue Bus Events Redis Cache Exception Routing Config Filesystem Session Console Foundation Support Container Hashing Translation Contracts Http Validation Cookie Pagination View Database Pipeline Chris van Daele - Introduction to Laravel 5 StackPHP - Der Kernel Symfony HttpKernelInterface middlewares • Authentifizierung • CSRF Protection • Encrypt Cookies • Session Handling Chris van Daele - Introduction to Laravel 5 The Inversion Of Control (IoC) IoC Binding $this->app->bind('FooBar', function($app) { return new FooBar($app['SomethingElse']); }); $this->app->singleton('FooBar', function($app) { return new FooBar($app['SomethingElse']); }); $this->app->bind( 'App\Contracts\SomeInterface', 'App\Services\ConcreteImplementation'‚ ); IoC Resolving $fooBar = $this->app->make('FooBar')->get('key'); Chris van Daele - Introduction to Laravel 5 Facades – It‘s all static? Route::get('/', 'HomeController@showWelcome'); Facade erstellen: 1. Ioc Binding 2. Facade Class $app['router']->get('/', 'HomeController@showWelcome'); 3. Facade Alias Configuration IoC Container Chris van Daele - Introduction to Laravel 5 MVC = EBC Model = Eloquent ORM View = Blade Template Engine Controller = Controller Chris van Daele - Introduction to Laravel 5 Model - Eloquent class User extends Eloquent { class Post extends Eloquent { public function posts() public function user() { { return $this->belongsTo('User'); return $this->hasMany('Post'); } } } } Chris van Daele - Introduction to Laravel 5 Model - Eloquent // User auslesen // Neuen User anlegen $users = User::all(); $user = new User; $user = User::where('name', '=', 'John Doe')->posts(); $user->name = 'John Doe'; $user = User::find(1); $user->save(); $user = User::findOrFail(1); // User löschen var_dump($user->name); $user = User::destroy(1); Chris van Daele - Introduction to Laravel 5 View – Blade Template <!-- Stored in resources/views/layouts/master.blade.php --> <html> <body> <div class="container"> @yield('content') </div> </body> </html> <!-- Stored in resources/views/layouts/home.blade.php --> @extends('layouts.master') @section('content') Hello, {{ $name }}. @foreach ($users as $user) <p>This is user {{ $user->id }}</p> @endforeach @stop Chris van Daele - Introduction to Laravel 5 Controller use App\Http\Requests\PurchasePodcastRequest; class PodcastController extends Controller { use DispatchesCommands; public function purchasePodcast(PurchasePodcastRequest $request, $podcastId) { $this->dispatch( new PurchasePodcast(Auth::user(), Podcast::findOrFail($podcastId)) ); } } Chris van Daele - Introduction to Laravel 5 CommandBus class PurchasePodcast extends Command implements SelfHandling { protected $user, $podcast; public function __construct(User $user, Podcast $podcast) { $this->user = $user; $this->podcast = $podcast; } public function handle() { // Handle the logic to purchase the podcast. event(new PodcastWasPurchased($this->user, $this->podcast)); } } Chris van Daele - Introduction to Laravel 5 Ressourcen ❖ http://laravel.com ❖ http://laracasts.com ❖ http://laravel.io/forum ❖ http://laracasts.com/discuss ❖ http://laravel-news.com ❖ http://mattstauffer.co ❖ http://daylerees.com ❖ http://fideloper.com/tag/laravel ❖ http://laracon.eu (25.08. – 26.08.2015, Amsterdam. YAY!) Chris van Daele - Introduction to Laravel 5 Fin. Vielen Dank für die Aufmerksamkeit ! Chris van Daele - Introduction to Laravel 5 .
Details
-
File Typepdf
-
Upload Time-
-
Content LanguagesEnglish
-
Upload UserAnonymous/Not logged-in
-
File Pages20 Page
-
File Size-