PHP code example of fanmade / laravel-service-binding
1. Go to this page and download the library: Download fanmade/laravel-service-binding library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
fanmade / laravel-service-binding example snippets
public function register()
{
$this->app->bind(FooRepositoryInterface::class, EloquentFooRepository::class);
if (env('ELASTICSEARCH_FOO_SERVICE', 'default')) {
$this->app->bind(FooSearchServiceInterface::class, ElasticSearchFooSearchService::class);
} else {
$this->app->bind(FooSearchServiceInterface::class, EloquentFooSearchService::class);
}
}