PHPackages                             casdoor/casdoor-php-sdk - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Authentication &amp; Authorization](/categories/authentication)
4. /
5. casdoor/casdoor-php-sdk

ActiveLibrary[Authentication &amp; Authorization](/categories/authentication)

casdoor/casdoor-php-sdk
=======================

PHP client SDK for Casdoor

v1.5.0(1mo ago)2420.3k↓49.1%10[2 issues](https://github.com/casdoor/casdoor-php-sdk/issues)[1 PRs](https://github.com/casdoor/casdoor-php-sdk/pulls)Apache-2.0PHPPHP &gt;=8.0CI failing

Since Sep 8Pushed 1mo ago2 watchersCompare

[ Source](https://github.com/casdoor/casdoor-php-sdk)[ Packagist](https://packagist.org/packages/casdoor/casdoor-php-sdk)[ RSS](/packages/casdoor-casdoor-php-sdk/feed)WikiDiscussions master Synced yesterday

READMEChangelog (8)Dependencies (7)Versions (12)Used By (0)

casdoor-php-sdk
===============

[](#casdoor-php-sdk)

[![Latest Stable Version](https://camo.githubusercontent.com/b3f541780fcc0b6b4e7505393d932ee2e4d0935d84370490d7a3bb3754a09b7f/687474703a2f2f706f7365722e707567782e6f72672f636173646f6f722f636173646f6f722d7068702d73646b2f76)](https://packagist.org/packages/casdoor/casdoor-php-sdk)[![Total Downloads](https://camo.githubusercontent.com/3e2526eba2b1f5c5af288f69e69273403e839fdc9b0dc12e270879014f6702e6/687474703a2f2f706f7365722e707567782e6f72672f636173646f6f722f636173646f6f722d7068702d73646b2f646f776e6c6f616473)](https://packagist.org/packages/casdoor/casdoor-php-sdk)[![License](https://camo.githubusercontent.com/ddf88efd4bb995645316f7abd92652ab4f57df76d5da044eeb9896787dcc46c9/687474703a2f2f706f7365722e707567782e6f72672f636173646f6f722f636173646f6f722d7068702d73646b2f6c6963656e7365)](https://packagist.org/packages/casdoor/casdoor-php-sdk)[![PHP Version Require](https://camo.githubusercontent.com/ca084a927b3e2246f71bcf7771b6727f8899d034c4ba4c151558c40045c012f7/687474703a2f2f706f7365722e707567782e6f72672f636173646f6f722f636173646f6f722d7068702d73646b2f726571756972652f706870)](https://packagist.org/packages/casdoor/casdoor-php-sdk)

PHP client SDK for [Casdoor](https://casdoor.org/).

Installation
------------

[](#installation)

```
composer require casdoor/casdoor-php-sdk
```

Quick Start
-----------

[](#quick-start)

Initialize the client:

```
use Casdoor\Client;

$client = new Client(
    endpoint: 'https://door.casdoor.com',
    clientId: 'YOUR_CLIENT_ID',
    clientSecret: 'YOUR_CLIENT_SECRET',
    certificate: file_get_contents('/path/to/public_key.pem'),
    organizationName: 'built-in',
    applicationName: 'app-built-in'
);
```

Auth / OAuth
------------

[](#auth--oauth)

```
// Get OAuth sign-in URL
$signinUrl = $client->getSigninUrl('https://your-app.com/callback');

// Exchange authorization code for access token
$token = $client->getOAuthToken($code, $state);

// Parse JWT token
$claims = $client->parseJwtToken($token->getToken());
```

User Management
---------------

[](#user-management)

```
use Casdoor\User;

// Get all users
$users = $client->getUsers();

// Get single user
$user = $client->getUser('alice');

// Create user
$user = new User();
$user->name = 'alice';
$user->email = 'alice@example.com';
$client->addUser($user);

// Update user
$user->displayName = 'Alice';
$client->updateUser($user);

// Delete user
$client->deleteUser($user);

// Paginate users
[$users, $total] = $client->getPaginationUsers(1, 10);
```

Role &amp; Permission Management
--------------------------------

[](#role--permission-management)

```
use Casdoor\Role;
use Casdoor\Permission;

$roles = $client->getRoles();
$permissions = $client->getPermissions();

$role = new Role();
$role->name = 'admin';
$client->addRole($role);
```

Other Resources
---------------

[](#other-resources)

The SDK supports the full Casdoor API. Available methods follow the same patterns:

ResourceMethodsOrganizationgetOrganization, getOrganizations, addOrganization, updateOrganization, deleteOrganizationApplicationgetApplications, getApplication, addApplication, updateApplication, deleteApplicationGroupgetGroups, getGroup, addGroup, updateGroup, deleteGroupCertgetCerts, getCert, addCert, updateCert, deleteCertProvidergetProviders, getProvider, addProvider, updateProvider, deleteProviderResourcegetResources, getResource, uploadResource, deleteResourceWebhookgetWebhooks, getWebhook, addWebhook, updateWebhook, deleteWebhookSessiongetSessions, getSession, addSession, updateSession, deleteSessionSyncergetSyncers, getSyncer, addSyncer, updateSyncer, deleteSyncerPlangetPlans, getPlan, addPlan, updatePlan, deletePlanPricinggetPricings, getPricing, addPricing, updatePricing, deletePricingSubscriptiongetSubscriptions, getSubscription, addSubscription, updateSubscription, deleteSubscriptionProductgetProducts, getProduct, addProduct, updateProduct, deleteProductOrdergetOrders, getOrder, addOrder, updateOrder, deleteOrder, cancelOrderPaymentgetPayments, getPayment, addPayment, updatePayment, deletePaymentTransactiongetTransactions, getTransaction, addTransaction, updateTransaction, deleteTransactionInvitationgetInvitations, getInvitation, addInvitation, updateInvitation, deleteInvitationAdaptergetAdapters, getAdapter, addAdapter, updateAdapter, deleteAdapterEnforcergetEnforcers, getEnforcer, addEnforcer, updateEnforcer, deleteEnforcerModelgetModels, getModel, addModel, updateModel, deleteModelPolicygetPolicies, addPolicy, updatePolicy, removePolicyEmailsendEmail, sendEmailByProviderSMSsendSms, sendSmsByProviderLDAPgetLdaps, getLdap, addLdap, updateLdap, deleteLdap, getLdapUsers, syncLdapUsersLicense
-------

[](#license)

[Apache 2.0](LICENSE)

###  Health Score

54

—

FairBetter than 96% of packages

Maintenance88

Actively maintained with recent releases

Popularity38

Limited adoption so far

Community17

Small or concentrated contributor base

Maturity59

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 57.1% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~191 days

Recently: every ~241 days

Total

8

Last Release

53d ago

PHP version history (3 changes)v1.0.0PHP &gt;=7.1.0

v1.1.0PHP &gt;=7.4.0

v1.5.0PHP &gt;=8.0

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/3787410?v=4)[Yang Luo](/maintainers/hsluoyz)[@hsluoyz](https://github.com/hsluoyz)

---

Top Contributors

[![basakest](https://avatars.githubusercontent.com/u/47746206?v=4)](https://github.com/basakest "basakest (20 commits)")[![hsluoyz](https://avatars.githubusercontent.com/u/3787410?v=4)](https://github.com/hsluoyz "hsluoyz (6 commits)")[![Linvery](https://avatars.githubusercontent.com/u/23356865?v=4)](https://github.com/Linvery "Linvery (6 commits)")[![i0gan](https://avatars.githubusercontent.com/u/42000708?v=4)](https://github.com/i0gan "i0gan (1 commits)")[![netandreus](https://avatars.githubusercontent.com/u/313477?v=4)](https://github.com/netandreus "netandreus (1 commits)")[![nomeguy](https://avatars.githubusercontent.com/u/85475922?v=4)](https://github.com/nomeguy "nomeguy (1 commits)")

---

Tags

authauthenticationauthncasdooroauthoidcphpsamlssoauthAuthenticationSSOsamloauthoidccasdoorauthn

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/casdoor-casdoor-php-sdk/health.svg)

```
[![Health](https://phpackages.com/badges/casdoor-casdoor-php-sdk/health.svg)](https://phpackages.com/packages/casdoor-casdoor-php-sdk)
```

###  Alternatives

[ellaisys/aws-cognito

Laravel Authentication using AWS Cognito (Web and API)

123256.9k1](/packages/ellaisys-aws-cognito)[google/auth

Google Auth Library for PHP

1.4k294.2M218](/packages/google-auth)[civicrm/civicrm-core

Open source constituent relationship management for non-profits, NGOs and advocacy organizations.

751291.4k43](/packages/civicrm-civicrm-core)[tempest/framework

The PHP framework that gets out of your way.

2.2k34.4k15](/packages/tempest-framework)[thenetworg/oauth2-azure

Azure Active Directory OAuth 2.0 Client Provider for The PHP League OAuth2-Client

25310.7M83](/packages/thenetworg-oauth2-azure)[xeroapi/xero-php-oauth2

Xero official PHP SDK for oAuth2 generated with OpenAPI spec 3

1054.7M18](/packages/xeroapi-xero-php-oauth2)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
