1. Go to this page and download the library: Download casdoor/casdoor-php-sdk 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/ */
casdoor / casdoor-php-sdk example snippets
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'
);
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 = '[email protected]';
$client->addUser($user);
// Update user
$user->displayName = 'Alice';
$client->updateUser($user);
// Delete user
$client->deleteUser($user);
// Paginate users
[$users, $total] = $client->getPaginationUsers(1, 10);
use Casdoor\Role;
use Casdoor\Permission;
$roles = $client->getRoles();
$permissions = $client->getPermissions();
$role = new Role();
$role->name = 'admin';
$client->addRole($role);
bash
composer
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.