PHPackages                             wesley0010012/http-request - 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. wesley0010012/http-request

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

wesley0010012/http-request
==========================

Simple HttpRequest Interface

3.1.0(12mo ago)172MITPHP

Since Mar 29Pushed 12mo ago1 watchersCompare

[ Source](https://github.com/Wesley0010012/HttpRequest)[ Packagist](https://packagist.org/packages/wesley0010012/http-request)[ RSS](/packages/wesley0010012-http-request/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependenciesVersions (9)Used By (0)

HttpRequest
===========

[](#httprequest)

Description
-----------

[](#description)

The `HttpRequest` provides a simple interface for making HTTP requests. This facade encapsulates the complexity of creating HTTP requests, allowing intuitive GET, POST, PUT, PATCH, and DELETE calls.

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

[](#installation)

If you are using Composer, add the dependency to your project:

```
composer require wesley0010012/http-request
```

Usage
-----

[](#usage)

Every request is maked using `HttpRequestFacade`.

Before making any requests, you can set the HttpRequestFacade to the singleton mode, preventing creation of some dependencies before every request:

```
use Wesley0010012\HttpRequest\Facades\HttpRequestFacade;

HttpRequestFacade::singleton();
```

### Making a GET Request

[](#making-a-get-request)

```
$response = HttpRequestFacade::get('https://api.example.com/data');

echo $response->getStatusCode()->value;
echo $response->getBody();
```

### Making a POST Request

[](#making-a-post-request)

```
$response = HttpRequestFacade::post(
    'https://api.example.com/users',
    json_encode(['name' => 'John', 'email' => 'john@email.com']),
    ['Content-Type' => 'application/json']
);

echo $response->getStatusCode()->value;
echo $response->getBody();
```

### Making a PUT Request

[](#making-a-put-request)

```
$response = HttpRequestFacade::put(
    'https://api.example.com/users/1',
    json_encode(['name' => 'John Doe']),
    ['Content-Type' => 'application/json']
);

echo $response->getStatusCode()->value;
echo $response->getBody();
```

### Making a PATCH Request

[](#making-a-patch-request)

```
$response = HttpRequestFacade::patch(
    'https://api.example.com/users/1',
    json_encode(['email' => 'new@email.com']),
    ['Content-Type' => 'application/json']
);

echo $response->getStatusCode()->value;
echo $response->getBody();
```

### Making a DELETE Request

[](#making-a-delete-request)

```
$response = HttpRequestFacade::delete('https://api.example.com/users/1');

echo $response->getStatusCode()->value;
echo $response->getBody();
```

Method Parameters
-----------------

[](#method-parameters)

All request methods follow the same signature:

```
HttpRequestFacade::{method}(string $url, mixed $body = null, array $headers = [], int $timeout = 30): HttpResponse
```

- (*string*)`: The request URL.
- `(*mixed*)`: The request body, optional for `GET` and `DELETE`.
- `(*array*)`: HTTP headers.
- `(*int*)`: Request timeout in seconds (default: `30`).

Response
--------

[](#response)

Each request returns an `HttpResponse` object, which can be used to access:

- `getStatusCode()`: Returns the HTTP status code of the response.
- `getBody()`: Returns the response body or null if not exists.

Statuses
--------

[](#statuses)

Each HTTP status exposes the following methods to accurately classify the nature of the response:

- `isInformational()` (bool): Return if is a Informational status;
- `isSuccess()` (bool): Return if is a Success status;
- `isRedirection()` (bool): Return if is a Redirection status;
- `isClientError()` (bool): Return if is a Client Error status;
- `isServerError()` (bool): Return if is a Server Error status;

### Example Usage:

[](#example-usage)

```
echo $response->getStatusCode()->value; // 200
echo $response->getBody(); // "{\"message\": \"Success\"}"
```

License
-------

[](#license)

This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.

###  Health Score

30

—

LowBetter than 65% of packages

Maintenance50

Moderate activity, may be stable

Popularity12

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity42

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 ~15 days

Total

4

Last Release

361d ago

Major Versions

1.0.0 → 2.0.02025-04-15

2.0.0 → 3.0.02025-04-21

### Community

Maintainers

![](https://www.gravatar.com/avatar/0f9e47d87f9151b4479a223ae7eb87fd2671f3fc0c37b50e475e1af930016374?d=identicon)[Wesley0010012](/maintainers/Wesley0010012)

---

Top Contributors

[![Wesley0010012](https://avatars.githubusercontent.com/u/66687111?v=4)](https://github.com/Wesley0010012 "Wesley0010012 (29 commits)")

### Embed Badge

![Health badge](/badges/wesley0010012-http-request/health.svg)

```
[![Health](https://phpackages.com/badges/wesley0010012-http-request/health.svg)](https://phpackages.com/packages/wesley0010012-http-request)
```

###  Alternatives

[friendsofsymfony/rest-bundle

This Bundle provides various tools to rapidly develop RESTful API's with Symfony

2.8k73.3M317](/packages/friendsofsymfony-rest-bundle)[php-http/discovery

Finds and installs PSR-7, PSR-17, PSR-18 and HTTPlug implementations

1.3k309.5M1.2k](/packages/php-http-discovery)[nyholm/psr7

A fast PHP7 implementation of PSR-7

1.3k235.4M2.4k](/packages/nyholm-psr7)[pusher/pusher-php-server

Library for interacting with the Pusher REST API

1.5k94.8M292](/packages/pusher-pusher-php-server)[spatie/crawler

Crawl all internal links found on a website

2.8k16.3M52](/packages/spatie-crawler)[react/http

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

78126.4M414](/packages/react-http)

PHPackages © 2026

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