PHPackages                             shewa12/wp-http-client - 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. shewa12/wp-http-client

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

shewa12/wp-http-client
======================

A wrapper class for making HTTP requests using WordPress wp\_remote\_request API's.

v1.0.0(2y ago)315BSD-3-ClausePHPPHP &gt;=7.4

Since Aug 6Pushed 2y ago1 watchersCompare

[ Source](https://github.com/shewa12/wp-http-client)[ Packagist](https://packagist.org/packages/shewa12/wp-http-client)[ Docs](https://github.com/shewa12/wp-http-client)[ RSS](/packages/shewa12-wp-http-client/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (2)Used By (0)

wp-http-client
==============

[](#wp-http-client)

The `wp-http-client` is a PHP composer package to make HTTP requests using the WordPress API. It provides methods for making GET, POST, PUT, and DELETE requests with ease. This class is especially useful for developers who are working on WordPress plugins or themes and need to interact with external APIs or remote services.

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

[](#installation)

```
composer require shewa12/wp-http-client

```

Instantiating the HTTPClient Class
----------------------------------

[](#instantiating-the-httpclient-class)

To use the `wp-http-client`, create an instance of it as follows:

```
use Shewa\WP_HTTP_Client\HTTPClient;

// Instantiate the HTTPClient class
$http_client = new HTTPClient();
```

Usage
-----

[](#usage)

`request()` method is responsible for performing http requests. This method accept four params. These are:

- $request, required. Which request need to make. Supported values: get, post, put, patch, delete.
- $url, required. Where to make request
- $data required if request is not get or delete
- $args optional, pass to override default values

Example of get request:

```
$url = 'https://api.example.com/data';
$response = $http_client->request( 'get', $url );

if ( ! is_wp_error( $response ) ) {
	// Process the response data
	print_r( $response );
} else {
	// Handle the error
	echo 'Error: ' . $response->get_error_message();
}
```

Example of post request:

```
$url = 'https://api.example.com/data';
$data = ['name' => 'John'];
$response = $http_client->request( 'post', $url, $data );

if ( ! is_wp_error( $response ) ) {
	// Process the response data
	print_r( $response );
} else {
	// Handle the error
	echo 'Error: ' . $response->get_error_message();
}
```

Response
--------

[](#response)

Response will be either WP\_Error or Array.

Successful response will return array like below:

```
$response = array(
	'headers' => [],
	'code'    => 200,
	'message' => 'OK',
	'body'    => [],
);
```

Methods
-------

[](#methods)

- REQUEST
- GET
- POST
- PUT
- PATCH
- DELETE

Supported HTTP Arguments &amp; Default Values
---------------------------------------------

[](#supported-http-arguments--default-values)

```
$defaults = array(
	'method'              => 'GET',
	'timeout'             => 5,
	'redirection'         => 5,
	'httpversion'         => 1.0,
	'user-agent'          => 'WordPress/' . get_bloginfo( 'version' ) . '; ' . get_bloginfo( 'url' )',
	'reject_unsafe_urls'  => false,
	'blocking'            => true,
	'headers'             => array(),
	'cookies'             => array(),
	'body'                => null,
	'compress'            => false,
	'decompress'          => true,
	'sslverify'           => true,
	'sslcertificates'     => ABSPATH . WPINC . '/certificates/ca-bundle.crt',
	'stream'              => false,
	'filename'            => null,
	'limit_response_size' => null,
);
```

###  Health Score

22

—

LowBetter than 22% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity10

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity43

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

Unknown

Total

1

Last Release

1007d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/72765924fadb6e703e407fac1575fd62b4dae343b375ecd43116a9ab915878f5?d=identicon)[shewa](/maintainers/shewa)

---

Top Contributors

[![shewa12](https://avatars.githubusercontent.com/u/30765517?v=4)](https://github.com/shewa12 "shewa12 (21 commits)")

---

Tags

http clientwp\_remote\_request

### Embed Badge

![Health badge](/badges/shewa12-wp-http-client/health.svg)

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

###  Alternatives

[psr/http-client

Common interface for HTTP clients

1.7k680.7M2.1k](/packages/psr-http-client)[kriswallsmith/buzz

Lightweight HTTP client

2.0k31.3M440](/packages/kriswallsmith-buzz)[react/http

Event-driven, streaming HTTP client and server implementation for ReactPHP

78126.4M414](/packages/react-http)[smi2/phpclickhouse

PHP ClickHouse Client

83510.1M71](/packages/smi2-phpclickhouse)[eightpoints/guzzle-bundle

Integrates Guzzle 6.x, a PHP HTTP Client, into Symfony. Comes with easy and powerful configuration options and optional plugins.

45912.1M55](/packages/eightpoints-guzzle-bundle)[laminas/laminas-http

Provides an easy interface for performing Hyper-Text Transfer Protocol (HTTP) requests

3729.5M266](/packages/laminas-laminas-http)

PHPackages © 2026

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