pawanmore/scalekit-php-sdk
最新稳定版本:v1.0.3
Composer 安装命令:
composer require pawanmore/scalekit-php-sdk
包简介
PHP SDK for Scalekit - Enterprise Authentication Platform
README 文档
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();
统计信息
- 总下载量: 12
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-07-10