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-09-17 01:15:01 UTC
README
这个库提供了对KnowBe4培训、钓鱼、用户和组数据的访问。它利用PSR18 HTTP客户端(symfony/http-client或其它)来为您的项目提供灵活性。
###非常基础的用法
$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);
}