composer正在为Supervisor安装PHP库



我正在尝试安装PHP Supervisor库。

我尝试使用以下composer.json 安装库

{
    "require": {
        "supervisorphp/supervisor": "^3.0",
        "lstrojny/fxmlrpc": "0.10.0",
        "egeloen/http-adapter": "*",
        "guzzlehttp/guzzle" : "*"
    }
}

然后运行

composer update

然后,我正在尝试运行以下示例程序

<?php    
use SupervisorSupervisor;
use SupervisorConnectorXmlRpc;
use fXmlRpcClient;
use fXmlRpcTransportHttpAdapterTransport;
use IvoryHttpAdapterGuzzle6HttpAdapter;
//Create GuzzleHttp client
$guzzleClient = new GuzzleHttpClient(['auth' => ['user', '123']]);
// Pass the url and the guzzle client to the XmlRpc Client
$client = new Client(
    'http://127.0.0.1:9001/RPC2',
    new HttpAdapterTransport(new Guzzle6HttpAdapter($guzzleClient))
);
// Pass the client to the connector
// See the full list of connectors bellow
$connector = new XmlRpc($client);
$supervisor = new Supervisor($connector);
// returns Process object
$process = $supervisor->getProcess('test_process');
// returns array of process info
$supervisor->getProcessInfo('test_process');
// same as $supervisor->stopProcess($process);
$supervisor->stopProcess('test_process');
// Don't wait for process start, return immediately
$supervisor->startProcess($process, false);
// returns true if running
// same as $process->checkState(Process::RUNNING);
$process->isRunning();
// returns process name
echo $process;
// returns process information
$process->getPayload();

我得到以下错误

Class 'GuzzleHttpPsr7Request' not found in /test/vendor/egeloen/http-adapter/src/Guzzle6HttpAdapter.php on line 135

我设法在PHP 5.4.14 上使用以下compose.json文件运行了该程序

{
    "require": {
        "supervisorphp/configuration": "^0.2.0",
        "supervisorphp/supervisor": "^3.0",
        "lstrojny/fxmlrpc": "0.10.0",
        "php-http/guzzle5-adapter" : "*",
        "egeloen/http-adapter" : "*"
    }
}

此外,以下是程序

<?php    
use SupervisorSupervisor;
use SupervisorConnectorXmlRpc;
use fXmlRpcClient;
use fXmlRpcTransportHttpAdapterTransport;
use IvoryHttpAdapterGuzzle5HttpAdapter;
//Create GuzzleHttp client
$guzzleClient = new GuzzleHttpClient(['auth' => ['user', '123']]);
// Pass the url and the guzzle client to the XmlRpc Client
$client = new Client(
    'http://127.0.0.1:9001/RPC2',
    new HttpAdapterTransport(new Guzzle5HttpAdapter($guzzleClient))
);
// Pass the client to the connector
// See the full list of connectors bellow
$connector = new XmlRpc($client);
$supervisor = new Supervisor($connector);
// returns Process object
$process = $supervisor->getProcess('test_process');
// returns array of process info
$supervisor->getProcessInfo('test_process');
// same as $supervisor->stopProcess($process);
$supervisor->stopProcess('test_process');
// Don't wait for process start, return immediately
$supervisor->startProcess($process, false);
// returns true if running
// same as $process->checkState(Process::RUNNING);
$process->isRunning();
// returns process name
echo $process;
// returns process information
$process->getPayload();

相关内容

  • 没有找到相关文章

最新更新