Created
June 23, 2018 08:22
-
-
Save lmillucci/6aafa88823f86445dd3866cb31cffb93 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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