malc0mn / vultr-api-client
api.vultr.com 的 PHP API 客户端
1.1.3
2017-12-11 08:47 UTC
Requires
- php: >=5.4.0
Requires (Dev)
- guzzlehttp/guzzle: 5.3 - 6.3
- phpunit/phpunit: >=4.8
Suggests
- guzzlehttp/guzzle: To use GuzzleHttpAdapter, require guzzlehttp/guzzle:^5.0|^6.0
This package is not auto-updated.
Last update: 2024-09-28 19:20:27 UTC
README
使用 composer 安装
打开 shell,cd
到您的项目目录,并输入
composer require malc0mn/vultr-api-client
或编辑 composer.json 并添加
{ "require": { "malc0mn/vultr-api-client": "~1.0" } }
如果您想使用 GuzzleHttpAdapter
,则需要添加 Guzzle 5 或 Guzzle 6。
使用示例
Guzzle
require 'vendor/autoload.php'; use Vultr\VultrClient; use Vultr\Adapter\GuzzleHttpAdapter; // Using Guzzle 5 or 6... $client = new VultrClient( new GuzzleHttpAdapter('your-api-key') ); $result = $client->metaData()->getAccountInfo(); var_export($result);
CURL
require 'vendor/autoload.php'; use Vultr\VultrClient; use Vultr\Adapter\CurlAdapter; // Using regular CURL, courtesy of 'usefulz' $client = new VultrClient( new CurlAdapter('your-api-key') ); $result = $client->metaData()->getAccountInfo(); var_export($result);
Vultr API 文档
完整的 API 文档可以在 https://www.vultr.com/api 找到,并且部分已添加到实现实际调用的 PHP 函数的 PHP DocBlocks 中。
致谢
此 API 的原始版本由 usefulz 完成。此版本已被 integr.io 分支用于我们的一款 Symfony 应用程序。它已被重新设计,以考虑扩展性和易用性。