Tag Archives: laravel-routing

Too much magic in Laravel when routing without facades?

Some people say that Laravel’s facades are optional, and if you don’t want to use them, then you can use dependency injection or the helper methods instead.

Laravel does have a powerful DI container. I have tried to go as facade-less as I can, but again I’ve found routing to be a pain.

Using some of PHP’s magic methods, Laravel likes to proxy calls. A lot. The obvious examples are, of course, Facades. When you call something like Cache::get('something'), Laravel proxies that call into the container and whatever service is required. There’s even an explanation in the official documentation.

Continue reading Too much magic in Laravel when routing without facades?

Multiple Subdomain and TLD Routing in Laravel 5

A recent project I’ve been working on has a requirement to have two concurrent versions of an application running on different subdomains.

It looks something like:

  • sandbox.example.com – A sandbox version of the application
  • live.example.com – The live version

The local developer version has the same URLs, just with a .test or .local TLD.

Laravel 5 supports subdomain routing, but not really for this use case, and honestly, not all that well out of the box.

Continue reading Multiple Subdomain and TLD Routing in Laravel 5