macromindonline / vultr-api-client
api.vultr.com 的 PHP API 客户端
1.1.2
2017-09-30 17:59 UTC
Requires
- php: >=5.4.0
Requires (Dev)
- guzzlehttp/guzzle: 5.3 - 6.1
- 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-18 05:08:52 UTC
README
使用 composer 安装
打开终端,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 应用程序。它已经重新工作,考虑到了可扩展性和易用性。