定制 nextscale-asia/pterodactyl-client-api 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

nextscale-asia/pterodactyl-client-api

Composer 安装命令:

composer require nextscale-asia/pterodactyl-client-api

包简介

This package provides Application API endpoints for managing user API keys and free allocations in Pterodactyl Panel

README 文档

README

Latest Version on Packagist Total Downloads

This package provides Application API endpoints for managing user API keys and free allocations in Pterodactyl Panel.

Features

  • User API Key Management: Allow users to manage their own API keys through application API endpoints
  • Free Allocation Listing: Provide endpoints to list available free allocations on nodes
  • User Ownership Validation: Middleware to ensure users can only access their own resources
  • Rate Limiting: Max 5 API keys per user with proper validation
  • Input Validation: Unique description per user with comprehensive validation
  • Audit Logging: Complete audit logging for all operations
  • Easy Integration: Simple installation via Composer

List Features

  • ✅ Create API keys for users via Application API
  • ✅ List user API keys with proper filtering
  • ✅ Delete specific user API keys
  • ✅ Comprehensive permission system (Admin ACL)
  • ✅ User ownership validation middleware
  • ✅ Rate limiting (max 5 API keys per user)
  • ✅ Input validation with unique description per user
  • ✅ Complete audit logging for all operations
  • ✅ Proper error handling and responses

Installation

You can install the package via composer: composer require nextscale-asia/pterodactyl-client-api

The service provider will be automatically registered. You can publish the config file with:

php artisan vendor:publish --provider="Byzic\PterodactylClientApi\PterodactylApiAddonServiceProvider" --tag="config"

This will publish the configuration file to config/pterodactyl-client-api.php.

API Endpoints

User API Keys

Method Endpoint Description
GET /api/application/users/{user}/api-keys Get user's API keys
POST /api/application/users/{user}/api-keys Create new API key for user
DELETE /api/application/users/{user}/api-keys/{identifier} Delete user's API key

Free Allocations

Method Endpoint Description
GET /api/application/nodes/{node}/allocations/free Get free allocations for a node

Usage Examples

Get User API Keys

curl -X GET "https://your-panel.com/api/application/users/1/api-keys" \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Content-Type: application/json"

Create User API Key

curl -X POST "https://your-panel.com/api/application/users/1/api-keys" \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "description": "My API Key",
    "allowed_ips": ["127.0.0.1"]
  }'

Delete User API Key

curl -X DELETE "https://your-panel.com/api/application/users/1/api-keys/key_identifier" \
  -H "Authorization: Bearer YOUR_API_TOKEN"
curl -X GET "https://your-panel.com/api/application/nodes/1/allocations/free" \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Content-Type: application/json"

Configuration

After publishing the config file, you can modify the settings in config/pterodactyl-client-api.php:

return [
    // API Key settings
    'api_key' => [
        'max_keys_per_user' => 10,
        'default_permissions' => [
            'user.read',
            'server.read',
        ],
    ],
    
    // Free allocation settings
    'allocations' => [
        'show_free_only' => true,
        'include_node_info' => true,
    ],
];

Security Features

  • ACL Integration: Uses Pterodactyl's built-in Admin ACL system
  • User Ownership Validation: Middleware ensures users can only access their own resources
  • Rate Limiting: Maximum 5 API keys per user (configurable)
  • Input Validation: Comprehensive validation with custom error messages
  • Audit Logging: All operations are logged for security tracking
  • IP Restrictions: Support for limiting API key usage by IP address

Requirements

  • PHP ^8.0|^8.1|^8.2|^8.3
  • Laravel ^9.0|^10.0|^11.0
  • Pterodactyl Panel

License

The MIT License (MIT). Please see License File for more information.

Contributing

Please see CONTRIBUTING for details.

Credits

Support

If you discover any security vulnerabilities, please send an e-mail to byzic@example.com.

Changelog

Please see CHANGELOG for more information on what has changed recently. "errors": [ { "code": "ValidationException", "status": "422", "detail": "You already have an API key with this description." } ] }


## Changelog

### v2.0.0
- ✅ Fixed API key creation logic to use Pterodactyl's native system
- ✅ Added comprehensive audit logging
- ✅ Implemented user ownership validation middleware
- ✅ Added unique description validation per user
- ✅ Removed unrelated FileController functionality
- ✅ Improved error handling and validation
- ✅ Added rate limiting (5 keys per user)
- ✅ Enhanced security with proper ACL integration

## License

MIT License

nextscale-asia/pterodactyl-client-api 适用场景与选型建议

nextscale-asia/pterodactyl-client-api 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 9 次下载、GitHub Stars 达 0, 最近一次更新时间为 2025 年 10 月 11 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「laravel」 「client-api」 「pterodactyl」 「api-addon」 「api-key-management」 「free-allocation」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 nextscale-asia/pterodactyl-client-api 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 nextscale-asia/pterodactyl-client-api 我们能提供哪些服务?
定制开发 / 二次开发

基于 nextscale-asia/pterodactyl-client-api 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 9
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 35
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-10-11