cspray / http-request-builder
A fluent API to build Requests for use with amphp/http-client
1.3.0
2023-04-13 14:18 UTC
Requires
- php: ^8.1
- amphp/http: ^v2.0
- amphp/http-client: ^v5.0
Requires (Dev)
- phpunit/phpunit: ^10.0
- roave/security-advisories: dev-latest
README
A library to fluently create amphp/http-client Request objects.
Installation
composer require cspray/http-request-builder
Usage
This library has 1 focused purpose; easily create Requests.
<?php declare(strict_types=1); use Cspray\HttpRequestBuilder\RequestBuilder; $request = RequestBuilder::withJsonBody([ 'three words' => 'enthusiastic,positivity,clashing' ])->post('https://api.example.com'); \Amp\Http\Client\HttpClientBuilder::buildDefault()->request($request);