cornford / guzzle-cloudflare-middleware
Cloudflare Middleware For Guzzle
v1.0.0
2020-06-11 07:44 UTC
Requires
- php: ^7.1
- guzzlehttp/guzzle: ^6.3
This package is auto-updated.
Last update: 2024-12-11 18:41:14 UTC
README
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