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 1mo ago

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 19% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity5

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity45

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

991d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/e7cd67f1a892c5ce209e55ff8c3f8900e60cf54bde45f0cd261abe7035c3c997?d=identicon)[ostin-power](/maintainers/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

[spatie/crawler

Crawl all internal links found on a website

2.8k16.3M52](/packages/spatie-crawler)[omniphx/forrest

A Laravel library for Salesforce

2724.4M8](/packages/omniphx-forrest)[akamai-open/edgegrid-client

Implements the Akamai {OPEN} EdgeGrid Authentication specified by https://developer.akamai.com/introduction/Client\_Auth.html

482.5M6](/packages/akamai-open-edgegrid-client)[muhammadhuzaifa/telescope-guzzle-watcher

Telescope Guzzle Watcher provide a custom watcher for intercepting http requests made via guzzlehttp/guzzle php library. The package uses the on\_stats request option for extracting the request/response data. The watcher intercept and log the request into the Laravel Telescope HTTP Client Watcher.

98239.8k1](/packages/muhammadhuzaifa-telescope-guzzle-watcher)[onesignal/onesignal-php-api

A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com

34170.2k2](/packages/onesignal-onesignal-php-api)[ory/hydra-client-php

Documentation for all of Ory Hydra's APIs.

1710.8k](/packages/ory-hydra-client-php)

PHPackages © 2026

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