gathern/casdoor-api
Composer 安装命令:
composer require gathern/casdoor-api
包简介
A skeleton repository for my packages
README 文档
README
This package provides a wonderful Casdoor-api integration for PHP projects.
Requires PHP 8.1+
Installation
You can install the package via composer:
composer require gathern/casdoor-api
Usage
$connector = new \Gathern\CasdoorAPI\CasdoorConnector();
Available Endpoints
User API
// Create a new user $response = $connector->userApi()->apiControllerAddUser( name: 'username' ); // Update user password $response = $connector->userApi()->apiControllerSetUserPassword( userName: 'username', newPassword: 'new_password' );
Login API
// Login with username and password $response = $connector->loginApi()->apiControllerLogin( application: 'your-app-name', username: 'username', signinMethod: \Gathern\CasdoorAPI\Enum\SignInMethod::PASSWORD, password: 'password' ); // Get JWT token using client credentials $response = $connector->TokenApi()->apiControllerGetOauthToken( clientId: 'your-client-id', clientSecret: 'your-client-secret', grantType: \Gathern\CasdoorAPI\Enum\GrantType::CLIENT_CREDENTIALS );
Role API
// Get all roles $response = $connector->roleApi()->apiControllerGetRoles(); // Get role details $response = $connector->roleApi()->apiControllerGetRole(id: 'role-name'); // Add a new role $response = $connector->roleApi()->apiControllerAddRole( name: 'new-role', displayName: 'New Role' ); // Update a role $response = $connector->roleApi()->apiControllerUpdateRole( id: 'role-name', displayName: 'Updated Role Name' ); // Update role from role data object $roleDetails = $connector->roleApi()->apiControllerGetRole(id: 'role-name')->dto(); $response = $connector->roleApi()->apiControllerUpdateRoleFromRoleData( $roleDetails->data, displayName: 'Updated Role Name' );
Group API
// Get all groups $response = $connector->groupApi()->apiControllerGetGroups('organization-name'); // Get group details $response = $connector->groupApi()->apiControllerGetGroup(id: 'group-name'); // Add a new group $response = $connector->groupApi()->apiControllerAddGroup( name: 'new-group' ); // Update a group $response = $connector->groupApi()->apiControllerUpdateGroup( id: 'group-name', name: 'updated-group-name' );
Handling Responses
All API methods return a response object with the following methods:
// Get the response as a DTO $responseDto = $response->dto(); // Check the status of the response if ($responseDto->status === \Gathern\CasdoorAPI\Enum\ResponseStatus::OK) { // Success $data = $responseDto->data; } else { // Error $errorMessage = $responseDto->msg; }
🧹 Keep a modern codebase with Pint:
composer lint
✅ Run refactors using Rector
composer refacto
⚗️ Run static analysis using PHPStan:
composer test:types
✅ Run unit tests using PEST
composer test:unit
🚀 Run the entire test suite:
composer test
gathern/casdoor-api 适用场景与选型建议
gathern/casdoor-api 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 2.64k 次下载、GitHub Stars 达 0, 最近一次更新时间为 2025 年 02 月 02 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「php」 「Gathern」 「CasdoorAPI」 「Casdoor-api」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 gathern/casdoor-api 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 gathern/casdoor-api 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 gathern/casdoor-api 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
this package provide growthbook (a feature flag serice) provider to openfeature
Alfabank REST API integration
Zero-dependency raw PHP DNS resolver, domain-ownership verification, and intoDNS/MxToolbox-style diagnostics. Queries authoritative nameservers directly over sockets — never trusts the recursive cache for ownership checks.
A lightweight plain-PHP framework for database-backed CRUD APIs.
bughq error tracking - PHP SDK
ABsurge PHP SDK for feature flags and A/B testing
统计信息
- 总下载量: 2.64k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 20
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-02-02