swisnl / laravel-psr-http-client-bridge
Laravel PSR-18 HTTP Client Bridge
Requires
- php: ^7.4|^8.0
- laravel/framework: ^8.0|^9.0
- php-http/httplug: ^2.0
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.8
- guzzlehttp/guzzle: ^7.4
- orchestra/testbench: ^6.24|^7.5
- phpunit/phpunit: ^9.5
This package is auto-updated.
Last update: 2023-03-17 11:03:49 UTC
README
Provides a bridge to use the Laravel HTTP Client as PSR-18 (or PHP-HTTP) HTTP Client. Created as an experiment to use the HTTP response fakes and assertions in tests, for libraries that require a PSR-18 HTTP Client.
Install
Via Composer
$ composer require swisnl/laravel-psr-http-client-bridge
Usage
$client = new Swis\Laravel\Bridge\PsrHttpClient\Client(); $request = new Psr\Http\Message\RequestImplementation(); $response = $client->sendRequest($request);
If you want to configure some request options, you can provide a callable that returns a PendingRequest
.
$client = new Swis\Laravel\Bridge\PsrHttpClient\Client(fn () => Http::withOptions(['proxy' => 'http://localhost:8125']));
Change log
Please see CHANGELOG for more information on what has changed recently.
Testing
$ composer test
Contributing
Please see CONTRIBUTING and CODE_OF_CONDUCT for details.
Security
If you discover any security related issues, please email security@swis.nl instead of using the issue tracker.
Credits
License
The MIT License (MIT). Please see License File for more information.
This package is Treeware. If you use it in production, then we ask that you buy the world a tree to thank us for our work. By contributing to the Treeware forest you’ll be creating employment for local families and restoring wildlife habitats.
SWIS ❤️ Open Source
SWIS is a web agency from Leiden, the Netherlands. We love working with open source software.