26 lines
584 B
PHP
26 lines
584 B
PHP
<?php
|
|
|
|
namespace Negundo\Client\Transport;
|
|
|
|
use GuzzleHttp\Client;
|
|
|
|
class GuzzleClient implements TransportInterface {
|
|
|
|
public int $timeout = 1;
|
|
|
|
public bool $throwErrors = false;
|
|
|
|
public array $headers = [];
|
|
|
|
public function push(string $url, array $data) : object|null|bool
|
|
{
|
|
return ( new Client([
|
|
'timeout' => $this->timeout,
|
|
]) )->post($url, [
|
|
'form_params' => $data,
|
|
'http_errors' => $this->throwErrors,
|
|
'headers' => $this->headers,
|
|
]);
|
|
}
|
|
}
|