igfs/kernel/helpers/RESTClient.php
2024-11-19 13:43:13 +03:00

25 lines
505 B
PHP

<?php
namespace kernel\helpers;
use GuzzleHttp\Exception\GuzzleException;
use http\Client;
class RESTClient
{
/**
* @throws GuzzleException
*/
public static function request(string $url, string $method = 'GET'): \Psr\Http\Message\ResponseInterface
{
$client = new \GuzzleHttp\Client();
return $client->request($method, $url, [
'headers' => [
'Authorization' => 'Bearer ' . $_ENV['MODULE_SHOP_TOKEN']
]
]);
}
}