slacker775 / knowbe4-kmsat-api
KnowBe4 KMSAT API
1.1.0
2021-11-16 19:14 UTC
Requires
Requires (Dev)
- jane-php/open-api-3: ^7.0
- monolog/monolog: ^2.3
- nyholm/psr7: ^1.4
- php-http/logger-plugin: ^1.2
- symfony/flex: ^1.15
- symfony/http-client: ^5.3
This package is auto-updated.
Last update: 2024-11-17 01:36:04 UTC
README
This library provices access to the KnowBe4 training, phishing, user and group data. It leverages PSR18 HTTP clients (symfony/http-client or others) to provide flexibility with your project.
###Really basic usage
$KNOWBE4_API_TOKEN = '12345';
$bearerAuth = new BearerAuthAuthentication(
$KNOWBE4_API_TOKEN
);
$httpClient = getHttpClient([new AuthenticationRegistry([$bearerAuth])]);
$apiClient = \KnowBe4\Kmsat\Api\Client::create($httpClient);
$result = $apiClient->getAccount();
function getHttpClient(array $additionalPlugins = []): PluginClient
{
$httpClient = Psr18ClientDiscovery::find();
$plugins = [];
$uri = Psr17FactoryDiscovery::findUrlFactory()->createUri(
'https://us.api.knowbe4.com'
);
$plugins[] = new AddHostPlugin($uri);
if (count($additionalPlugins) > 0) {
$plugins = array_merge($plugins, $additionalPlugins);
}
return new PluginClient($httpClient, $plugins);
}