mechta-market/php-http-client

There is no license information available for the latest version (1.0.2) of this package.

Installs: 1 501

Dependents: 1

Suggesters: 0

Security: 0

Stars: 0

Watchers: 1

Forks: 0

Open Issues: 0

pkg:composer/mechta-market/php-http-client

1.0.2 2024-09-04 10:09 UTC

This package is auto-updated.

Last update: 2025-10-04 12:34:20 UTC


README

GitHub Actions Workflow Status Packagist Downloads

Установка

composer require mechta-market/php-http-client

Примеры:

GET запрос

$httpClient = new HttpClient();
$response = $httpClient->get("example.org");

var_dump($response->successful());

GET запрос с параметрами

$httpClient = new HttpClient();
$httpClient->withQueryParameters(["foo" => "bar", "test" => "value"]);
$response = $httpClient->get("example.org");

var_dump($response->successful());

POST запрос

$httpClient = new HttpClient();
$data = ["foo" => "bar"];
$response = $httpClient->post("example.org", $data);

var_dump($response->successful());

POST запрос с body

$httpClient = new HttpClient();
$data = ["foo" => "bar"];
$httpClient->withBody($data);

$response = $httpClient->post("example.org");

Bearer token

$httpClient = new HttpClient();
$httpClient->withToken("random_string_token_value");

$response = $httpClient->get("example.org");

Basic auth

$httpClient = new HttpClient();
$httpClient->withBasicAuth("user", "random_string_token_value");

$response = $httpClient->get("example.org");