an introduction to the laravel framework (afup forum php 2014)
DESCRIPTION
An introduction to, and history of, the Laravel framework for PHP.TRANSCRIPT
An Introduction to Laravel PHP( and history of )
Who the fudge is this guy?
• Dayle Rees.
• 30 in December. *cry*
• Lives in Cardiff with GF Emma.
Welsh!( Sounds English )
The Red Panda GuyAlso Big Panda / PHPanda / 1000s of others.
( Now, Le Panda Rouge? )
• Head of Development
• Startup (Seed round A)
• Index Ventures (Facebook!)
• Sharing Economy
• http://www.justpark.com
• (Previously ParkatmyHouse)
Laravel Team Member• One of the first users.
• Team of high profile PHP developers.
• Laravel 3 Bundles
• Laravel 4 Bundles
Author
Over 7000 readers. #1 gross earnings. http://leanpub.com/codebright
Accidental
Spoke
Washington DC (Laracon US 2013) New York (Laracon US 2014)
Attended
Amsterdam (Laracon EU 2013) Amsterdam (Laracon EU 2014)
Laracons!
Colour Schemes “Engineer”
http://github.com/daylerees/colour-schemes
100 or so themes for a numbers of editors and libraries.
Merci!
What’s this talk all about?
Open source, history and growth. (Story time.)
Laravel. (Cool stuff!)
Let’s go back in time to 2011!(Imagine wibbly-wobbly effect.)
Working in Aberystwyth
•Using CodeIgniter.
•Simple projects.
•No side projects.
•Not “known” for anything.
Contributed to CodeIgniter
Started out with graphic contributions. Accepted by Phil Sturgeon. (Thanks Phil!)
Rejected by EllisLab. Started to outgrow the framework.
Time for a new framework!
VS
Laravel 2.something
• Simple website. • Great documentation. • Clean and simple code. • No users. • Mystery author.
Community time!• Became active in IRC. • Then: 3 people. Now: ~600. • Started writing tutorials. • Tutorials got attention. • Released Code Happy. • CodeIgniter users shifting across.
Involvement (L3)• Started submitting fixes and features to the pre-
release Laravel 3.
• Helped build/design the website for Laravel 3 (and later 4).
• Did lots of visual work for the framework including splash screens.
• Built popular bundles for Laravel 3.
• Help build a welcoming and helpful community.
Friendship
Taylor Otwell(Grand Master Artisan)
Laravel 3 had it’s flaws.
TESTING :(
EXTENSIBILITY :’(
Time for Laravel 4!• Taylor started work on Laravel 4.
• One of first users when it was built on Silex.
• Feedback loop.
• Exciting new architecture.
• Stable release cycle.
• Powered by Composer (Thanks Jordi!)
• Component-based framework.
• Uses plenty of open source! (Some Symfony, thanks Fabpot!)
The Promise• No preaching!
• No moaning about other frameworks.
• Just cool features!
• Intro to IOC / DI.
Laravel• Coding should be enjoyable. • Code can be art. • Clean and simple syntax. • Your framework should grow with you. • A complete platform, end to end. • Components that solve real problems.
• Embrace open source, and make use of it where possible.
• Give back to open source community where possible.
• A community of friendly Artisans.
Automatic type-hinted dependency resolution and injection inversion of control container.
Magic Code Box
Basic Usage
The same something!
Automatic Class Resolution( From the magic box! )
Type-hinted Dependency Resolution
Tricking the magic box.
Let’s do something cool.
Implementations
( Shameless colour schemes promo.)
Bind the interface.
( Still have no shame, I mean, just look at the beard.)
Use our new service.
Imagine username here.
Interchangeable!
Components / Services
Facades!
Resolve the service from the container (magic box) by known key.
Forward the method call to the real service instance with parameters.
Replacing components.
Why bind?
The Magic Box Revisited• Not just a data store!
• A number of binding methods.
• Automated class resolution.
• Automatic dependency injection.
• Interface binding.
• Service replacement / mocking.
• Extensible framework.
• Facades without the testing problems.
• The heart of the framework!
• illuminate/container
( Not so magic anymore, hopefully! )
Routes
Resource Controller
Named Routes
Route Filters
( Defaults: csrf auth auth.basic guest )
Route Groups
Database time!( Drivers: MySQL, PostgresSQL, SQLite, SQL Server )
Eloquent Models
Eloquent Models
Relationships
Relationships
Eager Loading
QueuesDrivers: Beanstalkd, IronMQ, Amazon SQS, Redis.
Queues
Authentication
Cache( Drivers: Database, File, APC, Memcached, XCache, WinCache, Redis, Array, Null )
Cache
Events
Model Events
Artisan
Artisan Commands
Sending Mail( Drivers: SMTP, Mailgun, Mandrill. )
Validation
( Because users are wrong… always. )
More!• Redis Client • Blade Templating • Stripe subscription-based billing. • Log system. • Custom exception handling. • Informative debugging. • Form helpers. • Localisation. • Workbench. • Paginator.
• Session Wrapper. • Remote SSH component. • Test helpers. • Database seeding. • Route model binding. • Response casting. • Environment-based config loader.
Loads more! Hands are tired from typing.
Laravel Forge
• PHP Hosting for Artisans. • Push to deploy. • Choose your own cloud. • Latest web stack. • HHVM ready. • Recipes. (stored scripts)
Homestead• Ubuntu 14.04 • PHP 5.6 • HHVM • Nginx • MySQL • Postgres • Node (With Bower,
Grunt, and Gulp)
• Redis • Memcached • Beanstalkd • Laravel Envoy • Fabric + HipChat
Extension
What are you waiting for?( Thanks for listening! Sorry if I’ve got 20 minutes left! )
composer create-project laravel/laravel
• Visit #laravel on Freenode. • Read Code Bright (come give me your email for a free copy) • Watch some Laracasts! (Sup Jeff!) • Visit Laravel.io and listen to the podcast! • Follow some Laravel guys on twitter. ( @daylerees @taylorotwell @jeffrey_way ) • Come say bonjour to me!