privyreza/rm-php-sdk
Composer 安装命令:
composer require privyreza/rm-php-sdk
包简介
Resell Domains, Hosting, and VPS
README 文档
README
The Resellme PHP SDK provides an easy-to-use interface for interacting with the Resellme API. It allows resellers to manage domains, hosting, VPS, nameservers, and contacts programmatically.
Features
- Domain Management: Search, register, transfer, and renew domains.
- Hosting Management: Create, provision, suspend, unsuspend, update, and terminate hosting accounts.
- VPS Management: Create and manage VPS instances.
- Nameserver Management: List, update, add, and delete nameservers.
- Contact Management: Create, update, and retrieve domain contacts.
- Centralized Request Handling: All API requests are handled through a centralized
RequestHandlerfor consistency and error handling.
Installation
Install the SDK via Composer:
composer require resellme/rm-php-sdk
Usage
Initialize the Client
require 'vendor/autoload.php'; use Resellme\Client; $client = new Client('your-api-token');
Domain Management
Search for a Domain
$domain = $client->domain()->search('example.com');
Register a Domain
$response = $client->domain()->register([ 'domain' => 'example.com', 'years' => 1, 'contact_id' => 'contact-id', ]);
Transfer a Domain
$response = $client->domain()->transfer([ 'domain' => 'example.com', 'auth_code' => 'auth-code', 'contact_id' => 'contact-id', ]);
Renew a Domain
$response = $client->domain()->renew('domain-id', [ 'years' => 1, ]);
Hosting Management
Create a Hosting Account
$response = $client->hosting()->create([ 'domain' => 'example.com', 'plan' => 'basic', ]);
List Hosting Accounts
$hostings = $client->hosting()->list();
Get Hosting Details
$hosting = $client->hosting()->get('hosting-id');
Update a Hosting Account
$response = $client->hosting()->update('hosting-id', [ 'plan' => 'premium', ]);
Suspend a Hosting Account
$response = $client->hosting()->suspend('hosting-id');
Unsuspend a Hosting Account
$response = $client->hosting()->unsuspend('hosting-id');
Terminate a Hosting Account
$response = $client->hosting()->terminate('hosting-id');
VPS Management
Create a VPS
$response = $client->vps()->create([ 'package_id' => 1, 'hostname' => 'vps.example.com', ]);
Manage a VPS
$response = $client->vps()->manage('vps-id', 'reboot');
Nameserver Management
List Nameservers
$nameservers = $client->nameserver()->list('domain-id');
Update Nameservers
$response = $client->nameserver()->update('domain-id', [ 'ns1.example.com', 'ns2.example.com', ]);
Add a Nameserver
$response = $client->nameserver()->add('domain-id', 'ns3.example.com');
Delete a Nameserver
$response = $client->nameserver()->delete('domain-id', 'ns3.example.com');
Contact Management
Create a Contact
$response = $client->contact()->create([ 'first_name' => 'John', 'last_name' => 'Doe', 'email' => 'john.doe@example.com', 'phone' => '+1234567890', 'address' => '123 Main St', 'city' => 'Example City', 'country' => 'US', ]);
Update a Contact
$response = $client->contact()->update('contact-id', [ 'email' => 'new.email@example.com', ]);
Get Contact Details
$contact = $client->contact()->get('contact-id');
Error Handling
The SDK throws exceptions for API errors. You can catch and handle these exceptions as follows:
use Resellme\Exceptions\ApiException; use Resellme\Exceptions\ServerException; try { $domain = $client->domain()->search('example.com'); } catch (ApiException $e) { echo "API Error: " . $e->getMessage(); } catch (ServerException $e) { echo "Server Error: " . $e->getMessage(); } catch (\Exception $e) { echo "Unexpected Error: " . $e->getMessage(); }
Testing
Run unit tests using PHPUnit:
vendor/bin/phpunit
Contributing
- Fork the repository.
- Create a new branch for your feature or bug fix.
- Submit a pull request with a detailed description of your changes.
License
This SDK is licensed under the MIT License. See the LICENSE file for details.
privyreza/rm-php-sdk 适用场景与选型建议
privyreza/rm-php-sdk 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 137 次下载、GitHub Stars 达 2, 最近一次更新时间为 2020 年 07 月 06 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 privyreza/rm-php-sdk 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 privyreza/rm-php-sdk 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 137
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 2
- 点击次数: 7
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2020-07-06