Laravel Facades Suck

Ok this one might be a bit controversial, but I feel this needs to be said. Facades seem like a weird middleman that just doesn’t add anything useful. Here’s why.

I work with a lot of PHP SDKs on a daily basis, and I use phpStorm both in my job and on personal projects at home. It’s a great and wonderful piece of software, I suggest you use it if you are ever going to take PHP development seriously (just be aware its a bit heavy Java app so it comes with all of the lovely things associated).

I really don’t get the point of these and for someone using a smart IDE like phpStorm they honestly seem… dumb. Let’s take this code snippet for example:


namespace App\Http\Controllers;

use Illuminate\Http\Request;

use Illuminate\Support\Facades\Storage;

class HomeController extends Controller

    public function index()

        Storage::disk('s3')->put('/some/path.txt', 'some amazing content for my file');

        return view('home');


So here we import the facade, and begin using it to put some data on S3. Sounds lovely and pleasant right? Well, it works ok in this example since not much can go wrong with S3. But let’s pretend something does go wrong and I want to see how that function… functions.

Using phpStorm I can cmd + click on a function name to go to a definition (after it has finished its endless loop of indexing…). So let’s do that. Let’s say I’m getting a weird error and want to look at what happens in the put() method. What am I presented with?

     * Write the contents of a file.
     * @param  string  $path
     * @param  string|resource  $contents
     * @param  mixed  $options
     * @return bool
    public function put($path, $contents, $options = []);


Well, that’s not helpful. What’s even worse is this is just an interface with no way of jumping right to the actual function that gets called. This means I have to hunt around for it or go browsing through the documentation. Not cool.

Just use actual functions people. None of this junk. Please! I hate how this is a standard in the Laravel community because it means I have to follow it to stick to conventions.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.