Laravel Http Client
Security covered
This module integrates the Laravel HTTP client into Drupal, providing a streamlined way to make HTTP requests with features like retries and custom headers, mirroring the functionality available in the Laravel framework. It allows developers to leverage Laravel's robust HTTP client capabilities directly within their Drupal projects.
Integrate the Laravel Http client with Drupal
use Drupal\laravel_http_client\Service\Http;
// Retry time and delay in ms.
Http::retry(3, 100)->withQueryParameters([
'name' => 'Taylor',
'page' => 1,
])->get('http://example.com/users')
Http::macro('github', function () {
return Http::withHeaders([
'X-Example' => 'example',
])->baseUrl('https://github.com');
});
$response = Http::github()->get('/');
Detail use of Laravel Http client
https://laravel.com/docs/11.x/http-client