PHPackages                             flores/request-manager - 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. flores/request-manager

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

flores/request-manager
======================

A simple HTTP request manager using cURL

1.0.2(1y ago)076MITPHPPHP &gt;=7.4

Since Mar 19Pushed 1y ago1 watchersCompare

[ Source](https://github.com/nelson-flores/request-manager)[ Packagist](https://packagist.org/packages/flores/request-manager)[ RSS](/packages/flores-request-manager/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (1)Dependencies (1)Versions (3)Used By (0)

HttpRequestManager
==================

[](#httprequestmanager)

A PHP library for managing HTTP requests using cURL.

📞 Installation
--------------

[](#-installation)

You can install this library via Composer:

```
composer require flores/request-manager
```

🚀 Usage
-------

[](#-usage)

### Creating a Request

[](#creating-a-request)

```
use Flores\RequestManager\Requests\GetRequest;

$request = new GetRequest('https://yoururl.com/api/resource');
$response = $request->send();

echo $response->getDataString();
```

### Setting Headers

[](#setting-headers)

```
$request->setHeader('Authorization', 'Bearer token')
        ->setHeader('Accept', 'application/json');
```

### Setting Authentication

[](#setting-authentication)

```
$request->setBearerToken('your_token_here'); // Uses Bearer Token authentication
$request->setAuth('username', 'password');   // Uses Basic Auth
```

### Sending JSON Data (POST)

[](#sending-json-data-post)

```
use Flores\RequestManager\Requests\PostRequest;

$request = new PostRequest('https://yoururl.com/api/resource');
$request->setJsonBody([
    'title' => 'New Post',
    'body' => 'Post content',
    'userId' => 1
]);
$response = $request->send();

echo $response->getData();
```

### Retrieving Response Data

[](#retrieving-response-data)

```
echo $response->getData();       // Returns the processed response (object)
echo $response->getDataString(); // Returns the processed response as JSON String
```

### Getting the Raw cURL Response

[](#getting-the-raw-curl-response)

If you need the raw response from the cURL request, use `getResponse()`:

```
echo $response->get(); // Returns the raw response as a string
```

### Available Methods

[](#available-methods)

#### Request Methods

[](#request-methods)

- `setUrl($url)`: Sets the request URL.
- `setHeader($key, $value)`: Sets an HTTP header.
- `setHeaders(array $headers)`: Sets multiple headers at once.
- `setPayloads(array $payloads)`: Sets the request body.
- `setJsonBody(array $data)`: Sets the request body as JSON.
- `setBearerToken($token)`: Sets the Authorization header using Bearer Token.
- `setAuth($user, $passwd)`: Sets Basic Authentication credentials.
- `setContentType($contentType)`: Sets the request content type.
- `setCurlOption($key, $value)`: Sets a custom cURL option.
- `getUrl()`: Returns the request URL.
- `getPayloads()`: Returns the data sent in the request.
- `getContentType()`: Returns the defined content type.
- `send()`: Executes the request and returns an `HttpResponse` object.

#### Response Methods

[](#response-methods)

- `get()`: Returns the raw cURL response.
- `getData()`: Returns the structured response (object).
- `getDataString()`: Returns the response in JSON format.

### Example of a DELETE Request

[](#example-of-a-delete-request)

```
use Flores\RequestManager\Requests\DeleteRequest;

$request = new DeleteRequest('https://yoururl.com/api/resource/1');
$response = $request->send();

echo $response->getDataString();
```

### Error Handling

[](#error-handling)

```
try {
    $request = new PostRequest('https://yoururl.com/api/resource');
    $request->setPayloads(['title' => 'Error Test']);
    $response = $request->send();
    echo $response->getData();
} catch (HttpRequestException $e) {
    echo "Request error: " . $e->getMessage();
} catch (HttpConnectionException $e) {
    echo "Connection error: " . $e->getMessage();
}
```

⚠️ Handled Exceptions
---------------------

[](#️-handled-exceptions)

- `InvalidContentTypeException`: Invalid content type.
- `HttpRequestException`: HTTP request error.
- `HttpConnectionException`: Server connection failure.

📄 License
---------

[](#-license)

This project is licensed under the [MIT License](LICENSE).

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance45

Moderate activity, may be stable

Popularity11

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity39

Early-stage or recently created project

 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

426d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/a92c90aeaf8cf54c36e5c7fdf5c329a5f7be5a9fbd8d995fb8a50f2be939c4f4?d=identicon)[nelsonflores\_mz](/maintainers/nelsonflores_mz)

---

Top Contributors

[![nelson-flores](https://avatars.githubusercontent.com/u/34948807?v=4)](https://github.com/nelson-flores "nelson-flores (6 commits)")

---

Tags

httprequestcurlhttp client

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/flores-request-manager/health.svg)

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

###  Alternatives

[smi2/phpclickhouse

PHP ClickHouse Client

84310.1M71](/packages/smi2-phpclickhouse)[aplus/http-client

Aplus Framework HTTP Client Library

2161.6M1](/packages/aplus-http-client)[pear/http_request2

Provides an easy way to perform HTTP requests.

764.2M48](/packages/pear-http-request2)[aura/http

The Aura HTTP package provides objects to build and send HTTP responses from the server to the client.

7338.8k4](/packages/aura-http)[zoonman/pixabay-php-api

PixabayClient is a PHP HTTP client library to access Pixabay's API

3354.7k](/packages/zoonman-pixabay-php-api)[phpgt/fetch

Asynchronous HTTP client with promises.

3724.0k3](/packages/phpgt-fetch)

PHPackages © 2026

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