laravel-wp-api/src/Cyberduck/LaravelWpApi/LaravelWpApiServiceProvider.php
2015-06-10 17:19:35 +01:00

60 lines
1.1 KiB
PHP
Executable file

<?php namespace Cyberduck\LaravelWpApi;
use Illuminate\Support\ServiceProvider;
class LaravelWpApiServiceProvider extends ServiceProvider {
/**
* Indicates if loading of the provider is deferred.
*
* @var bool
*/
protected $defer = false;
/**
* Bootstrap the application events.
*
* @return void
*/
public function boot()
{
$this->publishes([
__DIR__.'/../../config/config.php' => config_path('wp-api.php'),
]);
}
/**
* Register the service provider.
*
* @return void
*/
public function register()
{
$this->app->bindShared('wp-api', function ($app) {
$endpoint = $this->app['config']->get('wp-api.endpoint');
$auth = $this->app['config']->get('wp-api.auth');
$client = $this->app->make('GuzzleHttp\Client');
return new WpApi($endpoint, $client, $auth);
});
$this->app->bind('Cyberduck\LaravelWpApi\WpApi', function($app)
{
return $app['wp-api'];
});
}
/**
* Get the services provided by the provider.
*
* @return array
*/
public function provides()
{
return ['wp-api'];
}
}