Posted in Code on August 29th, 2014

The LaraconEU Reveal

Taylor's keynote at Laracon NYC introduced Forge and Homestead which set expectations quite high for Laracon keynotes going forward.

The Laracon EU keynote did not disappoint!

  • New Directory Structure: A new structure more appropriate for modern projects has been widely discussed as part of 4.3, so this came as little surprise. It's definitely a large leap forward (I especially like the new /resources directory, home to views, language files and other assets), though I'll likely still be making some modifications similar to those I've discussed here previously. The best part is that it seems completely configurable.

  • Service Provider Architecture: Routes, Filters, Error Handling, Logging... all get Service Providers. Many were doing this already for all but the most trivial projects so having the providers "out of the box" means less configuration to get new projects up and running. Service Providers for Filters means that they're now class based which I think is a big step forward. Overall, it's just a more consistent and cleaner architecture.

  • Route Caching: This is something that Symfony has had for some time now, so I'm pleased to see that it's come to Laravel (which utilizes the Symfony Routing Component under the hood) as well. As projects and their routing schemes become more complex, the performance benefits of caching routes simply can't be ignored.

  • Social Auth: Like Laravel Cashier, introduced during the lead up to Laracon NYC, Socialite is a stand alone package. It appears to be a revival of the forgotten Illuminate Socialite and provides drop in OAuth one and two authentication using popular social networks.

  • Contracts: The framework's interfaces and exceptions (and presumably abstract classes) will be broken out into their own repository. This is something that was recently discussed for Symfony but has been tabled until version 3.0; I'm thrilled to see it for Laravel 4.3. There is some inconsistency with the inclusion /omission of the "interface" suffix (I'm a big proponent of omitting "crutch" prefixes and suffixes like this), but I'm sure that'll be cleaned up before release.

  • Method Level Dependency Injection: This one is sure to generate a lot of excitement. I appreciate it as it allowed the framework to embrace namespaced controllers which in turn opened up the directory structure some. As I've been using a controller for each action (often called focused controllers, a name borrowed from the Rails community) for a while now, the primary benefit -- avoiding dependency overload -- is somewhat lost on me, but I realise that it's a tremendous boon for those who have been grouping conceptually similar controllers within a single class. This functionality was likely required, however, for the next new feature, one which I am especially excited about.

  • Request Object Validation: To me, this might be the most impactful of all of the forthcoming changes. I'm planning a dedicated post on this later this week, but the short version is that you will be able to type hint a controller method against a custom request type (one which extends FormRequest) which specifies validation rules for the request. When a route is matched, if the request is of type FormRequest, the request's validate() method will be called automatically by the framework.

  • FlySystem Integration: This continues Laravel's embracing "best of breed" packages from the greater PHP community in order to deliver "out of the box" functionality beyond that expected from a typical framework. FlySystem is used to provide configurable local and cloud filesystem abstraction. It's a fantastic package and having it integrated with the framework is a considerable convenience.