request($method, $url, [ 'headers' => [ 'Authorization' => 'Bearer ' . $_ENV['MODULE_SHOP_TOKEN'] ] ]); } /** * @throws GuzzleException */ public static function request_without_auth(string $url, string $method = 'GET'): \Psr\Http\Message\ResponseInterface { $client = new \GuzzleHttp\Client(); return $client->request($method, $url); } /** * @throws GuzzleException */ public static function post(string $url, array $data = [], bool $auth = true): \Psr\Http\Message\ResponseInterface { $headers = []; if ($auth){ $headers = [ 'Authorization' => 'Bearer ' . $_ENV['MODULE_SHOP_TOKEN'] ]; } $client = new \GuzzleHttp\Client(); return $client->request("POST", $url, [ 'form_params' => $data, 'headers' => $headers, ]); } }