tobischulz/laravel-respawnhost-sdk
Composer 安装命令:
composer require tobischulz/laravel-respawnhost-sdk
包简介
Laravel SDK for the RespawnHost.com API to manage game servers, files, backups, payments, and transactions.
README 文档
README
Laravel package to integrate with the official RespawnHost API and manage game servers from your application.
Current scope
This repository now contains a stable SDK foundation:
- centralized HTTP client with Bearer API key authentication
- configurable base URL, timeouts, retries, and user agent
- first resource clients for:
serverspaymentstransactionscatalog(public games + packages)
- dedicated exception type for failed API responses
- test baseline with Pest + Testbench
The current implementation was prepared against the public RespawnHost OpenAPI document (version: 1.0.0) and product context from respawnhost.com on February 13, 2026.
Installation
composer require tobischulz/laravel-respawnhost-sdk
Publish the configuration:
php artisan vendor:publish --tag="laravel-respawnhost-sdk-config"
Configuration
Set these environment variables:
RESPAWNHOST_BASE_URL=https://respawnhost.com/api/v1 RESPAWNHOST_API_KEY=your-api-key RESPAWNHOST_TIMEOUT=30 RESPAWNHOST_CONNECT_TIMEOUT=10 RESPAWNHOST_RETRY_TIMES=1 RESPAWNHOST_RETRY_SLEEP=200 RESPAWNHOST_USER_AGENT=laravel-respawnhost-sdk RESPAWNHOST_CATALOG_BASE_URL=https://respawnhost.com
Default config file (config/respawnhost-sdk.php):
return [ 'base_url' => env('RESPAWNHOST_BASE_URL', 'https://respawnhost.com/api/v1'), 'api_key' => env('RESPAWNHOST_API_KEY'), 'timeout' => (int) env('RESPAWNHOST_TIMEOUT', 30), 'connect_timeout' => (int) env('RESPAWNHOST_CONNECT_TIMEOUT', 10), 'retry' => [ 'times' => (int) env('RESPAWNHOST_RETRY_TIMES', 1), 'sleep' => (int) env('RESPAWNHOST_RETRY_SLEEP', 200), ], 'user_agent' => env('RESPAWNHOST_USER_AGENT', 'laravel-respawnhost-sdk'), 'catalog_base_url' => env('RESPAWNHOST_CATALOG_BASE_URL', 'https://respawnhost.com'), ];
API Token (Dev and Production)
As of February 13, 2026, the public RespawnHost docs state that API keys are created in the account dashboard:
Directlink to api-key-management Dashboard:
This route currently redirects unauthenticated users to login and is not explicitly documented in the public developer docs, so it may change.
Token for dev environment
- Log in to your RespawnHost dashboard.
- Open API key management from dashboard settings (or use the direct URL above).
- Create a dedicated dev key with only required scopes.
- Use it with the dev API base URL:
RESPAWNHOST_BASE_URL=https://respawnhost.com/api/v1 RESPAWNHOST_API_KEY=your-dev-api-key
Token for production environment
- Create a separate production key (do not reuse the dev key).
- Assign only required production scopes.
- Use it with the production API base URL:
RESPAWNHOST_BASE_URL=https://respawnhost.com/api/v1 RESPAWNHOST_API_KEY=your-production-api-key
Recommended: keep separate keys per app/environment and rotate them regularly.
Usage
Use the facade:
use TobiSchulz\LaravelRespawnHostSdk\Facades\RespawnHost; $servers = RespawnHost::servers()->all(['page' => 1, 'limit' => 10]); $server = RespawnHost::servers()->find('server-uuid'); $serverWithPanelData = RespawnHost::servers()->find('server-uuid', includePanelServer: true); RespawnHost::servers()->sendCommand('server-uuid', [ 'command' => 'say Hello from Laravel SDK', ]);
Rent a server (typed wrapper)
You can call server rent directly via facade with typed parameters:
use TobiSchulz\LaravelRespawnHostSdk\Facades\RespawnHost; $result = RespawnHost::rent( gameShort: 'enshrouded', // required planId: 324, // required region: 'eu', // optional: eu|us templateId: null, // optional templateVersionId: null, // optional instanceCount: 1, // optional, min 1 );
Validation behavior:
- required parameters (
gameShort,planId) must be present - invalid values (for example wrong
regionorinstanceCount < 1) throw an exception before the HTTP request - for pre-validation of
gameShort, useRespawnHost::gameByShort($gameShort)before rent
Public game catalog (typed models)
The package now supports these public catalog endpoints:
GET /api/gamesGET /api/games/short/{game_short}GET /api/games/short/{game_short}/packages
These endpoints are fetched through the SDK without requiring RESPAWNHOST_API_KEY.
Usage:
use TobiSchulz\LaravelRespawnHostSdk\Facades\RespawnHost; // list<CatalogGame> $games = RespawnHost::allGames(); // CatalogGame $game = RespawnHost::gameByShort('v-rising'); // list<CatalogGamePackage> $packages = RespawnHost::packagesByGameShort('v-rising');
These methods return immutable DTO-style classes:
TobiSchulz\LaravelRespawnHostSdk\Models\CatalogGameTobiSchulz\LaravelRespawnHostSdk\Models\CatalogGamePackage
Payments and transactions:
$payments = RespawnHost::payments()->all(['page' => 1]); $invoice = RespawnHost::payments()->downloadInvoice(123); $transactions = RespawnHost::transactions()->all(); $transaction = RespawnHost::transactions()->find(456);
For endpoints that are not wrapped yet, use the generic request method:
$response = RespawnHost::request( method: 'GET', uri: '/api/v1/servers/server-uuid/files', query: ['directory' => '/'] );
Error handling:
use TobiSchulz\LaravelRespawnHostSdk\Exceptions\RespawnHostRequestException; try { RespawnHost::transactions()->all(); } catch (RespawnHostRequestException $exception) { $status = $exception->response()->status(); $body = $exception->response()->json(); }
Development
composer install
composer test
composer analyse
composer format
Roadmap
- expand endpoint coverage based on OpenAPI tags:
servers/*(files, backups, schedules, shares, minecraft, databases)paymentstransactions
- add request/response DTOs and stronger typing
- add contract tests for critical workflows (rent, powerstate, backups, billing)
Detailed endpoint mapping is tracked in docs/API-COVERAGE.md.
License
MIT. See LICENSE.md.
tobischulz/laravel-respawnhost-sdk 适用场景与选型建议
tobischulz/laravel-respawnhost-sdk 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 4 次下载、GitHub Stars 达 1, 最近一次更新时间为 2026 年 02 月 25 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「sdk」 「laravel」 「API-Client」 「gameserver」 「respawnhost」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 tobischulz/laravel-respawnhost-sdk 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 tobischulz/laravel-respawnhost-sdk 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 tobischulz/laravel-respawnhost-sdk 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Skolkovo API Client
A client library for the OpenPLZ API project
Alfabank REST API integration
chargebee-php-sdk integration for WordPress
Laravel api client for zvonok.com service
统计信息
- 总下载量: 4
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 24
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2026-02-25