PSR-7 Request -- дефакто стандарт в отрасли
https://www.php-fig.org/psr/psr-7/
Вот простой http клиент:
https://github.com/zendframework/zend-diactoros
Пример использования:
// Create a request
$request = (new Zend\Diactoros\Request())
->withUri(new Zend\Diactoros\Uri('http://example.com'))
->withMethod('PATCH')
->withAddedHeader('Authorization', 'Bearer ' . $token)
->withAddedHeader('Content-Type', 'application/json');
// OR:
$request = new Zend\Diactoros\Request(
'http://example.com',
'PATCH',
'php://memory',
[
'Authorization' => 'Bearer ' . $token,
'Content-Type' => 'application/json',
]
);
// If you want to set a non-origin-form request target, set the
// request-target explicitly:
$request = $request->withRequestTarget((string) $uri); // absolute-form
$request = $request->withRequestTarget($uri->getAuthority()); // authority-form
$request = $request->withRequestTarget('*'); // asterisk-form
// Once you have the instance:
$request->getBody()->write(json_encode($data));
$response = $client->send($request);