pawanmore / scalekit-php-sdk
PHP SDK for Scalekit - Enterprise Authentication Platform
Installs: 12
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 0
Forks: 0
Open Issues: 0
pkg:composer/pawanmore/scalekit-php-sdk
Requires
- php: >=7.4
- ext-json: *
- guzzlehttp/guzzle: ^7.0
Requires (Dev)
- phpstan/phpstan: ^1.0
- phpunit/phpunit: ^9.0
README
PHP SDK for Scalekit - Enterprise Authentication Platform
Installation
composer require pawanmore/scalekit-php-sdk
Quick Start
<?php require_once 'vendor/autoload.php'; use Scalekit\ScalekitClient; // Initialize the client $client = new ScalekitClient( 'https://your-environment.scalekit.cloud', 'your-client-id', 'your-client-secret' ); // Get access token $tokenResponse = $client->auth->getAccessToken(); // List organizations $organizations = $client->organizations->listOrganizations(); // Create an organization $newOrg = $client->organizations->createOrganization([ 'display_name' => 'My Organization', 'region_code' => 'US' ]);
Authentication
The SDK uses OAuth2 client credentials flow for authentication:
// Get access token $tokenResponse = $client->auth->getAccessToken(); // The token is automatically set and used for subsequent requests
Available Services
AuthService
getAccessToken()- Get access token using client credentialsexchangeCodeForToken($code, $redirectUri)- Exchange authorization code for tokenrefreshToken($refreshToken)- Refresh access tokenrevokeToken($token)- Revoke access tokenintrospectToken($token)- Introspect tokengetUserInfo()- Get user info
OrganizationService
listOrganizations($params)- List organizationssearchOrganizations($params)- Search organizationscreateOrganization($data)- Create organizationgetOrganization($id)- Get organization by IDgetOrganizationByExternalId($externalId)- Get organization by external IDupdateOrganization($id, $data)- Update organizationupdateOrganizationSettings($id, $settings)- Update organization settingsdeleteOrganization($id)- Delete organization
SSOService
getAuthorizationUrl($params)- Generate authorization URL for SSOexchangeCodeForToken($code, $redirectUri)- Exchange code for token
DirectoryService
listDirectories($params)- List all directoriesgetDirectory($id)- Get directorylistUsersInDirectory($directoryId, $params)- List users in directorylistGroupsInDirectory($directoryId, $params)- List groups in directoryenableDirectory($id)- Enable directorydisableDirectory($id)- Disable directory
ConnectionService
listConnections($organizationId, $params)- List connectionsgetConnection($organizationId, $connectionId)- Get connectionenableConnection($organizationId, $connectionId)- Enable connectiongetConnectionProviders()- Get connection providers
UserService
listUsers($organizationId, $params)- List users in organizationcreateUser($organizationId, $userData)- Create user
AuthMethodsService
sendPasswordless($organizationId, $data)- Send passwordless authenticationverifyPasswordless($organizationId, $data)- Verify passwordless authenticationresendPasswordless($organizationId, $data)- Resend passwordless authenticationcreatePasswordlessConnection($organizationId, $data)- Create passwordless connectionupdatePasswordlessConnection($organizationId, $connectionId, $data)- Update passwordless connectionenablePasswordlessConnection($organizationId, $connectionId)- Enable passwordless connection
M2MService
createM2MClient($organizationId, $data)- Create M2M clientcreateM2MClientSecret($organizationId, $clientId)- Create M2M client secretgetM2MClient($organizationId, $clientId)- Get M2M clientrotateSecret($organizationId, $clientId)- Rotate M2M client secretupdateM2MClient($organizationId, $clientId, $data)- Update M2M client detailsgetM2MClientAccessToken($clientId, $clientSecret)- Get M2M client access tokendeleteM2MClientSecret($organizationId, $clientId, $secretId)- Delete M2M client secretdeleteM2MClient($organizationId, $clientId)- Delete M2M client
JWKSService
getJWKS()- Get JSON Web Key Set
OpenIDService
getConfiguration()- Get OpenID configuration
AdminPortalService
generatePortalLink($organizationId, $data)- Generate admin portal link
ClientService
getClient($clientId)- Get client by IDupdateClientRedirects($clientId, $redirects)- Update client redirects
Examples
Single Sign-On (SSO)
// Generate authorization URL $authUrl = $client->sso->getAuthorizationUrl([ 'redirect_uri' => 'https://your-app.com/callback', 'organization_id' => 'org_123', 'scope' => 'openid email profile' ]); // After user authentication, exchange code for token $tokenResponse = $client->sso->exchangeCodeForToken($code, $redirectUri);
Organization Management
// Create organization $organization = $client->organizations->createOrganization([ 'display_name' => 'Acme Corp', 'region_code' => 'US', 'metadata' => [ 'industry' => 'Technology' ] ]); // List organizations with pagination $organizations = $client->organizations->listOrganizations();