Brian Feaver gives an overview of the Laravel PHP framework. He explains that Laravel is built on Symfony components and provides services and libraries to make interacting with web requests easier. The basics covered include routing, controllers, templating with Blade, and Eloquent ORM. Cool features highlighted are Artisan, dependency injection, queues, middleware, filesystem abstraction, and built-in authentication. Facades are discussed as a way to access underlying services, though injecting services directly is preferable.
2. About Me
Lead Developer at WiseBanyan
Free online financial advisor
http://wisebanyan.com
10+ years of software development
3. Assumptions
You know these right?
Composer
Basic development environment
Can read documentation
http://laravel.com/docs/5.0#install-laravel
4. What am I covering?
What is Laravel?
Basics of Laravel (basics of any framework
ever?)
Some cool stuff about Laravel (packaged libraries
and services)
Some things not-so-cool
5. What is Laravel?
PHP Framework for Web Artisans
Built on top of Symfony2 Components
Like any framework, provides services and
libraries to make interacting with web requests
and other services
15. Eloquent (ORM)
Active Record
Table - plural, snake_case class name
Migrations
Support relationships
Soft deleting
Timestamps
16. Eloquent (ORM)
The Bad
Joins
Uses subqueries
You can do actual joins, but you have to write them using
the query builder yourself
Can cause missing information with duplicate columns
Eager loading - Model::with(relation)
Runs two queries
My usual Active Record gripes
21. Facades
What do they look like?
Facade::doSomethingCool()
Isnt that a static method?
Well, no
22. Facades
What are they?
A static access to underlying service
Look like static resources, but actually uses
services underneath
Can be mocked for testing (at least with
Mockery no comment)
23. Facades
Why you shouldnt use them
They hide the dependencies of the service or
class using them - This is the important one!
Can be overridden, but then you override them
everywhere
http://programmingarehard.com/2014/01/11/stop-using-facades.html
24. Facades
What to do instead
You can instead inject them by their
underlying service class names.
See:
http://laravel.com/docs/5.0/facades#facade-class-reference
28. Dependency Injection
(Container)
App::make() - Facade
Uses reflection to determine dependencies
Does not require any configuration
Can be configured with a ServiceProvider (PHP
class)
30. Queue (worker)
Use artisan to consume the job in the queue
php artisan queue:work
Also provides queue:listen and --daemon for
continuous workers
31. Middleware
Allows processing or filtering of requests entering
the system
http://laravel.com/docs/5.0/middleware
Encryption
Simplified encryption using mcrypt
http://laravel.com/docs/5.0/encryption
32. Filesystem
Abstraction layer to local and remote filesystems
Amazon S3
FTP/SFTP
Local
Dropbox
Uses the league/flysystem library
http://laravel.com/docs/5.0/filesystem
33. Authentication
Includes libraries to do basic username/password
authentication out of the box
Includes password recovery (Forgot password?)
Protecting routes using filters
http://laravel.com/docs/5.0/authentication