fozzyhosting / winvps-php-client

此包已被废弃,不再维护。未建议替代包。

Fozzy Windows VPS APIv2 PHP客户端库

v2.1.1 2023-02-10 10:16 UTC

This package is auto-updated.

Last update: 2024-06-10 14:32:27 UTC


README

此包引入了使用PHP 7.x的Windows VPS服务的APIv2。PHP8.x版本将很快推出。

它是现有 winvps-api-php 的完全重写,保留了API请求/响应格式。

安装

composer require fozzyhosting/winvps-php-client

用法

<?php

use Fozzy\WinVPS\Api\Client;

// Create API client
$client = Client::make('api-key');

// Returns list of all templates available for new machines
$templates = $client->templates()->list();

// View single Job details
$jobDetails = $client->jobs()->getById($jobId);

// Send single command which does not need additional options
$jobs = $client->machines()->sendCommandByName($machineName, 'restart');

以下插件引入了您可以使用的主要VPS实体

  • 品牌
  • 作业
  • 位置
  • 机器
  • 产品
  • 模板

所有类都在 src/v2/Entities/ 目录中进行了详细描述。响应对象的描述可以在 src/v2/Schemas/ 中找到。

测试

测试实现在 tests/ 目录中,并使用了PHPUnit和PHPStan开发依赖项。

./vendor/bin/phpunit

./vendor/bin/phpstan analyse