igfs/kernel/helpers/RESTClient.php

25 lines
505 B
PHP
Raw Normal View History

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