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(1y ago)278MITPHP

Since Mar 29Pushed 1y 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 today

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

29

—

LowBetter than 57% of packages

Maintenance46

Moderate activity, may be stable

Popularity11

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

Every ~15 days

Total

4

Last Release

415d ago

Major Versions

1.0.0 → 2.0.02025-04-15

2.0.0 → 3.0.02025-04-21

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/66687111?v=4)[Wesley Gabriel Laurindo](/maintainers/Wesley0010012)[@Wesley0010012](https://github.com/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

[php-http/cache-plugin

PSR-6 Cache plugin for HTTPlug

25126.1M82](/packages/php-http-cache-plugin)[illuminate/http

The Illuminate Http package.

11937.9M6.9k](/packages/illuminate-http)[rdkafka/rdkafka

A PHP extension for Kafka

2.2k24.3k1](/packages/rdkafka-rdkafka)[httpsoft/http-message

Strict and fast implementation of PSR-7 and PSR-17

87965.9k114](/packages/httpsoft-http-message)[mezzio/mezzio-router

Router subcomponent for Mezzio

265.4M91](/packages/mezzio-mezzio-router)[serpapi/google-search-results-php

Get Google, Bing, Baidu, Ebay, Yahoo, Yandex, Home depot, Naver, Apple, Duckduckgo, Youtube search results via SerpApi.com

69127.2k](/packages/serpapi-google-search-results-php)

PHPackages © 2026

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