cornford/guzzle-cloudflare-middleware

Cloudflare Middleware For Guzzle

v1.0.0 2020-06-11 07:44 UTC

This package is auto-updated.

Last update: 2024-10-11 18:22:17 UTC


README

Latest Stable Version Total Downloads Build Status Scrutinizer Code Quality

Installation

Begin by installing this package through Composer. Edit your project's composer.json file to require cornford/guzzle-cloudflare-middleware.

"require": {
    "cornford/guzzle-cloudflare-middleware": "1.*"
}

Finally, update Composer from the Terminal:

composer update

Usage

It's really as simple as using the middleware class with Guzzle:

use GuzzleHttp\Client;
use Cornford\GuzzleCloudflareMiddleware\CloudflareMiddleware;
use GuzzleHttp\Cookie\FileCookieJar;

$client = new Client(['cookies' => new FileCookieJar('cookies.txt')]);

$client->getConfig('handler')->push(CloudflareMiddleware::create());

$res = $client->request('GET', 'http://www.exemple.com/');
echo $res->getBody();

License

guzzle-cloudflare-middleware is open-sourced software licensed under the MIT license