1. Go to this page and download the library: Download kjdev/cedar 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/ */
interface AuthorizationClientInterface
{
public function isAuthorized(array $params): array;
public function isAuthorizedWithToken(array $params): array;
}
final class CedarLocalClient implements AuthorizationClientInterface
{
public function __construct(private readonly \Cedar\AuthorizationClient $client) {}
public function isAuthorized(array $params): array
{
return $this->client->isAuthorized($params);
}
public function isAuthorizedWithToken(array $params): array
{
return $this->client->isAuthorizedWithToken($params);
}
}
final class AvpClient implements AuthorizationClientInterface
{
public function __construct(
private readonly \Aws\VerifiedPermissions\VerifiedPermissionsClient $client,
) {}
public function isAuthorized(array $params): array
{
return $this->client->isAuthorized($params)->toArray();
}
public function isAuthorizedWithToken(array $params): array
{
return $this->client->isAuthorizedWithToken($params)->toArray();
}
}