Skip to content
Dashboard
Theme
Theme

PHP SDK

The OhAuthCat server SDK for PHP 8.2 and later.

View Markdown

PHP 8.2 or later, no Composer runtime dependencies. It uses ext-curl when available and PHP streams otherwise.

composer require ohauthcat/ohauthcat-php:0.0.2
  • Create a client: new OhAuthCatClient(getenv('OHAUTHCAT_API_KEY'), 'pk_...').
  • Call any API operation, for example $client->organizations->getOrganization('org_...'), or iterate listDirectoryUsersAutoPaging(...).
  • SSO: $client->ssoHelpers->getAuthorizationUrl($redirectUri, domain: 'customer.com') returns url and codeVerifier; then $client->ssoHelpers->getProfileAndToken($code, $verifier, $redirectUri).
  • Webhooks: Webhooks::verify(file_get_contents('php://input'), $_SERVER['HTTP_OHAUTHCAT_SIGNATURE'] ?? null, $secret).
  • Errors are OhAuthCatException subclasses, such as NotFoundException and RateLimitedException, with the stable $errorCode.
  • To use a PSR-18 HTTP client such as Guzzle, pass transport: new OhAuthCat\Psr18Transport(...).