Skip to content

Provider

Pedro Faria edited this page Apr 9, 2017 · 1 revision

Providers

You can extends or replace some funcionality of Hope using the Dependency Injection system. Just two steps and every thing is running.

  1. Create your own Provider.
<?php
namespace App\Providers;

class MyRequestProvider implements Hope\Contracts\ProviderInterface
{
    public static function register(Hope\Application $app)
    {
        $app->bind('Hope\Http\Request', function() {
            return new App\Http\MyRequest();
        });
    }
}
  1. Add it with the method addExternalProviders.
$app->addExternalProviders([
    App\Providers\YourProviderClassProvider::class,
]);

CAUTION: This method must stay before bootstrap().

Clone this wiki locally