When To Use Facades: Facades Vs. Helper Functions

Facades Vs. Helper Functions

Return View::make('profile');

return view('profile');
Route::get('/cache', function () {
    return cache('key');
});
Use Illuminate\Support\Facades\Cache;

/**
 * A basic functional test example.
 *
 * @return void
 */
public function testBasicExample()
{
    Cache::shouldReceive('get')
         ->with('key')
         ->andReturn('value');

    $this->visit('/cache')
         ->see('value');
}

There is absolutely no practical difference between facades and helper functions.

Many facade call and helper call are equivalent

Return View::make('profile');

return view('profile');

When To Use Facades: Facades Vs. Helper Functions — Structure map

Clickable & Draggable!

When To Use Facades: Facades Vs. Helper Functions — Related pages: