PHP code example of maximaster / cli-ent

1. Go to this page and download the library: Download maximaster/cli-ent library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

maximaster / cli-ent example snippets



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