1. Go to this page and download the library: Download kidfund/thin-transit-client 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/ */
kidfund / thin-transit-client example snippets
/**
* @return TransitClient|null
* @throws Exception
*/
protected function getTransitClient()
{
$enabled = config('vault.enabled');
if (!$enabled) {
return null;
}
$vaultAddr = config('vault.addr');
$vaultToken = config('vault.token');
if ($vaultToken === null || $vaultToken === 'none') {
throw new Exception('Vault token must be configured');
}
$client = new TransitClient($vaultAddr, $vaultToken);
return $client;
}
/**
* @return void
*/
public function register()
{
$this->app->singleton(TransitClient::class, function () {
return $this->getTransitClient();
});
}