votong/guzzle-cloudflare-middleware

Cloudflare Middleware For Guzzle

1.0.2 2024-05-01 16:47 UTC

This package is not auto-updated.

Last update: 2024-12-25 20:08:38 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 votong/guzzle-cloudflare-middleware.

"require": {
    "votong/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 VoTong\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