PHPackages                             effectra/http-extensions - 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. effectra/http-extensions

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

effectra/http-extensions
========================

The Effectra HTTP Extensions package.

v2.2.1(2y ago)04111MITPHPPHP ^8.0.2

Since Jun 19Pushed 2y agoCompare

[ Source](https://github.com/effectra/http-extensions)[ Packagist](https://packagist.org/packages/effectra/http-extensions)[ RSS](/packages/effectra-http-extensions/feed)WikiDiscussions main Synced today

READMEChangelog (7)Dependencies (2)Versions (8)Used By (1)

Effectra\\Http\\Extensions
==========================

[](#effectrahttpextensions)

Effectra\\Http\\Extensions is a PHP package that provides extensions and utilities for working with HTTP requests and responses.

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

[](#installation)

You can install this package via Composer. Run the following command in your project directory:

```
composer require effectra/http-extensions
```

Usage
-----

[](#usage)

### RequestExtension

[](#requestextension)

The `RequestExtension` class extends the `Effectra\Http\Message\ServerRequest` class and provides additional methods for working with HTTP requests.

#### Creating a Request

[](#creating-a-request)

You can create a new request using the `RequestExtension::fromGlobal()` method, which creates a request object based on the global variables:

```
$request = RequestExtension::fromGlobal();
```

#### Retrieving Request Information

[](#retrieving-request-information)

- `RequestExtension::url()`: Returns the URL of the request.
- `RequestExtension::method()`: Returns the HTTP method of the request.
- `RequestExtension::path()`: Returns the path of the request URI.
- `RequestExtension::inputs()`: Returns an object containing all input data from the request.
- `RequestExtension::input(string $input)`: Returns the value of a specific input parameter.
- `RequestExtension::validateInputs()`: Validates the input data using a third-party validation library.
- `RequestExtension::onlyInputs(array $inputs)`: Returns an object containing only the input data for the specified input keys.
- `RequestExtension::data(bool $associative = false)`: Returns the input data as an array or object.
- `RequestExtension::getTokenFromBearer()`: Extracts the token from the "Authorization" header (Bearer authentication).

### UriExtension

[](#uriextension)

The `UriExtension` class extends the `Effectra\Http\Message\Uri` class and provides additional methods for working with URIs.

#### Modifying Queries

[](#modifying-queries)

- `UriExtension::withQueries(array $queries)`: Returns a new URI object with the specified query parameters.

### ResponseExtension

[](#responseextension)

The `ResponseExtension` class extends the `Effectra\Http\Message\Response` class and provides additional methods for working with HTTP responses.

#### Creating a JSON Response

[](#creating-a-json-response)

- `ResponseExtension::json($data, int $status_code = 200, array $headers = [])`: Creates a JSON response with the specified data, status code, and additional headers.

#### Converting Response Body to Array

[](#converting-response-body-to-array)

- `ResponseExtension::jsonToArray(?bool $associative = null, int $depth = 512, int $flags = 0)`: Converts the response body from JSON to an associative array.

#### File Attachment

[](#file-attachment)

- `ResponseExtension::attachFile(string $filePath, ?string $filename = null, ?string $contentType = null)`: Creates a response with a file attachment.

#### Setting Cookies

[](#setting-cookies)

- `ResponseExtension::withCookie(string $name, string $value, int $expires = 0, string $path = '/', string $domain = '', bool $secure = false, bool $httpOnly = true)`: Sets a cookie with the given parameters.
- `ResponseExtension::withCookies(array $cookies, int $expires = 0, string $path = '/', string $domain = '', bool $secure = false, bool $httpOnly = true)`: Sets multiple cookies with the given parameters.

Contributing
------------

[](#contributing)

Contributions are welcome! If you find any issues or have suggestions for improvement, please open an issue or submit a pull request.

License
-------

[](#license)

This package is open-source software licensed under the [MIT license](https://opensource.org/licenses/MIT).

Credits
-------

[](#credits)

Effectra\\Http\\Extensions is developed and maintained by [Mohammed Taha](https://github.com/BmtMohammedTaha).

###  Health Score

25

—

LowBetter than 35% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity54

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

Total

7

Last Release

912d ago

Major Versions

v1.0.0 → v2.0.02023-06-29

### Community

Maintainers

![](https://www.gravatar.com/avatar/7e6219ae87e98df8783b2f595b013035dd183c0712afd24045a8acf0a40c3bdf?d=identicon)[effectra](/maintainers/effectra)

---

Top Contributors

[![BMTmohammedtaha](https://avatars.githubusercontent.com/u/95439605?v=4)](https://github.com/BMTmohammedtaha "BMTmohammedtaha (18 commits)")

---

Tags

extensionsphppsrpsr-7requestsresponsestreamuri

### Embed Badge

![Health badge](/badges/effectra-http-extensions/health.svg)

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

###  Alternatives

[guzzlehttp/psr7

PSR-7 message implementation that also provides common utility methods

8.0k1.1B3.9k](/packages/guzzlehttp-psr7)[aws/aws-sdk-php

AWS SDK for PHP - Use Amazon Web Services in your PHP project

6.3k543.5M2.6k](/packages/aws-aws-sdk-php)[neuron-core/neuron-ai

The PHP Agentic Framework.

2.0k656.1k38](/packages/neuron-core-neuron-ai)[tempest/framework

The PHP framework that gets out of your way.

2.2k34.4k14](/packages/tempest-framework)[telnyx/telnyx-php

Official Telnyx PHP SDK — APIs for Voice, SMS, MMS, WhatsApp, Fax, SIP Trunking, Wireless IoT, Call Control, and more. Build global communications on Telnyx's private carrier-grade network.

35789.4k2](/packages/telnyx-telnyx-php)[laudis/neo4j-php-client

Neo4j-PHP-Client is the most advanced PHP Client for Neo4j

185702.8k42](/packages/laudis-neo4j-php-client)

PHPackages © 2026

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