maximaster/cli-ent
最新稳定版本:v2.0.2
Composer 安装命令:
composer require maximaster/cli-ent
包简介
Guzzle handler to imitate HTTP calls through CLI
README 文档
README
Guzzle handler to imitate HTTP calls through CLI.
Installing
composer require maximaster/cli-ent
Reasoning
Imagine that you have a legacy CMS which can be installed only through web interface. By using the handler you can install such a CMS using CLI just by calling needed http queries like you would do it through web interface, but without running webserver.
Usage
<?php use GuzzleHttp\Client; use GuzzleHttp\HandlerStack; use Guzzle\Parser\Cookie\CookieParser; use Maximaster\CliEnt\CliEntHandler; use Maximaster\CliEnt\GlobalsParser; use Guzzle\Parser\Message\MessageParser; $cliEntHandler = new CliEntHandler( new GlobalsParser(new CookieParser()), new MessageParser(), '/var/www', function (array &$globals) { // you can mofify global variables here before execution $globals['_ENV'] = ['a' => 'Lorem', 'b' => 'ipsum']; $globals['_SERVER']['DOCUMENT_ROOT'] = '/var/www'; } ); $client = new Client(['handler' => HandlerStack::create($cliEntHandler)]); $response = $client->get('http://localhost/install.php'); // etc
Developing
composer run testto run tests;composer run lintto lint;
统计信息
- 总下载量: 1.36k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 0
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2020-12-26