PHPackages                             osti/http-client-php - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [HTTP &amp; Networking](/categories/http)
4. /
5. osti/http-client-php

ActiveLibrary[HTTP &amp; Networking](/categories/http)

osti/http-client-php
====================

HTTP client lib with PHP

1.0.1(2y ago)14MITPHP

Since Aug 28Pushed 2y ago1 watchersCompare

[ Source](https://github.com/ostin-power/http-client-php)[ Packagist](https://packagist.org/packages/osti/http-client-php)[ RSS](/packages/osti-http-client-php/feed)WikiDiscussions main Synced yesterday

READMEChangelogDependencies (1)Versions (4)Used By (0)

HttpClient PHP Class
====================

[](#httpclient-php-class)

Http Lib in PHP with support of Guzzle-HTTP

The `HttpClient` class is a PHP class that simplifies HTTP requests using the GuzzleHttp library. This class provides a straightforward interface for making HTTP GET, POST, PUT, and DELETE requests, while also allowing customization of request parameters, headers, and cookie management.

Installation
------------

[](#installation)

To use this class, you need to have the GuzzleHttp library installed. You can install it using Composer:

```
composer require osti/http-client-php
```

Usage
-----

[](#usage)

Here's an example of how to use the `HttpClient` class to make an HTTP GET request:

```
use HttpClient;

// Create an instance of HttpClient
$http = new HttpClient();

// Make an HTTP GET request
$response = $http->makeRequest('GET', 'https://www.example.com');

// Handle the response
if ($response !== false) {
    // The request was successful
    echo $response; // Response content
} else {
    // An error occurred during the request
    echo "Error during the request.";
}
```

Main Methods
============

[](#main-methods)

#### Constructor

[](#constructor)

The constructor of the `HttpClient` class accepts two optional parameters: `$cookies` and `$verify`. Setting $cookies to `true` will enable the use of cookies, and a temporary file will be created to store them. Setting `$verify` to `true` will enable SSL verification. Here's an example usage:

```
$http = new HttpClient($cookies = true, $verify = true);
```

#### addHeaders(array $headers)

[](#addheadersarray-headers)

Adds `HTTP headers` to the request. Here's an example:

```
$http->addHeaders([
    'User-Agent' => 'My User Agent',
    'Authorization' => 'Bearer Token123'
]);
```

#### setBody($params, $needEncode = true)

[](#setbodyparams-needencode--true)

Sets the `HTTP request` body. You can specify the parameters to send in the request. If `$needEncode` is set to `true`, the parameters will be encoded as JSON. Here's an example:

```
$http->setBody([
    'query' => ['key' => 'value'],
    'json' => ['data' => 'content']
]);
```

#### Other Methods

[](#other-methods)

The `HttpClient` class also offers other useful methods, such as `hideHeaders()`, `setTimeout()`, `setOption()`, `deleteOption()` and more.

###  Health Score

21

—

LowBetter than 18% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity5

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity46

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~0 days

Total

2

Last Release

1040d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/77856088?v=4)[Simone Ostini](/maintainers/ostin-power)[@ostin-power](https://github.com/ostin-power)

---

Top Contributors

[![ostin-power](https://avatars.githubusercontent.com/u/77856088?v=4)](https://github.com/ostin-power "ostin-power (3 commits)")

### Embed Badge

![Health badge](/badges/osti-http-client-php/health.svg)

```
[![Health](https://phpackages.com/badges/osti-http-client-php/health.svg)](https://phpackages.com/packages/osti-http-client-php)
```

###  Alternatives

[aws/aws-sdk-php

AWS SDK for PHP - Use Amazon Web Services in your PHP project

6.3k543.5M2.6k](/packages/aws-aws-sdk-php)[neuron-core/neuron-ai

The PHP Agentic Framework.

2.0k656.1k38](/packages/neuron-core-neuron-ai)[illuminate/http

The Illuminate Http package.

11937.9M6.9k](/packages/illuminate-http)[tencentcloud/tencentcloud-sdk-php

TencentCloudApi php sdk

3741.3M47](/packages/tencentcloud-tencentcloud-sdk-php)[guzzlehttp/guzzle-services

Provides an implementation of the Guzzle Command library that uses Guzzle service descriptions to describe web services, serialize requests, and parse responses into easy to use model structures.

25711.0M191](/packages/guzzlehttp-guzzle-services)[eslazarev/wildberries-sdk

Wildberries OpenAPI clients (generated).

273.0k](/packages/eslazarev-wildberries-sdk)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
