hotrush/scrapoxy-react-client
最新稳定版本:1.1.0
Composer 安装命令:
composer require hotrush/scrapoxy-react-client
包简介
Async client for Scrapoxy and ReactPHP
README 文档
README
Scrapoxy-React-Client
Async client for Scrapoxy and ReactPHP.
Installation
composer require hotrush/scrapoxy-react-client
Usage
use Hotrush\ScrapoxyClient\Client;
use React\EventLoop\Factory as LoopFactory;
$loop = LoopFactory::create();
$client = new Client('http://scrapoxy-host.com/api/', 'password', $loop);
$loop->run();
Get scaling
$client->getScaling()
->then(
function($scaling) {
var_dump($scaling);
},
function($exception) {
echo (string) $exception;
}
);
Will output your current scaling info:
[
"min" => 0,
"required" => 2,
"max" => 5,
]
Scaling up and down
$client->upScale()->then(...);
$client->downScale()->then(...);
Scaling up will update required instances number to maximum. Scaling down will update it to minimum.
Custom scaling
You can define your custom instances number:
$client->scale([
'min' => 0,
'max' => 10,
'required' => 5,
]);
Get and update config
$client->getConfig()->then(...);
$client->updateConfig([
'any_key' => 'any_value',
])->then(...);
Get instances
$client->getInstances()->then(...);
Stop instance by name
$client->stopInstance($name)->then(...);
Will throw NotFoundException if instance name not found.
Contribution
You are welcome to create any pull requests or write some tests!
统计信息
- 总下载量: 70
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 2
- 点击次数: 1
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2017-03-14