Skip to content

Instantly share code, notes, and snippets.

@lmillucci
Created June 23, 2018 08:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lmillucci/6aafa88823f86445dd3866cb31cffb93 to your computer and use it in GitHub Desktop.
Save lmillucci/6aafa88823f86445dd3866cb31cffb93 to your computer and use it in GitHub Desktop.
<?php
namespace LMillucci\CivicSIP\Providers;
use Illuminate\Support\ServiceProvider;
class CivicServiceProvider extends ServiceProvider
{
/**
* Bootstrap any application services.
*
* @return void
*/
public function boot()
{
$this->publishes([
__DIR__ . '/../../config/civic.php' => config_path('civic.php')
]);
}
/**
* Register the service provider.
*
* @return void
*/
public function register()
{
$this->app->singleton('civic', function ($app) {
$config = $app->make('config');
$httpClient = $app->make(\GuzzleHttp\ClientInterface::class);
$applicationID = $config->get('civic.applicationID');
$applicationSecret = $config->get('civic.applicationSecret');
$privateSigningKey = $config->get('civic.privateSigningKey');
$environment = $config->get('civic.environment');
$config = new \Blockvis\Civic\Sip\AppConfig(
$applicationID,
$applicationSecret,
$privateSigningKey,
$environment
);
return new \Blockvis\Civic\Sip\Client($config, $httpClient);
});
}
/**
* Get the services provided by the provider.
*
* @return array
*/
public function provides()
{
return ['civic'];
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment