PHPackages                             femastudios/http-utils - 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. femastudios/http-utils

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

femastudios/http-utils
======================

PHP collection of enums and basic utilities for HTTP

v1.0.1(4y ago)086[1 PRs](https://github.com/femastudios/php-http-utils/pulls)GPL-3.0-onlyPHPPHP &gt;=7.3CI failing

Since Jul 8Pushed 3mo ago1 watchersCompare

[ Source](https://github.com/femastudios/php-http-utils)[ Packagist](https://packagist.org/packages/femastudios/http-utils)[ RSS](/packages/femastudios-http-utils/feed)WikiDiscussions master Synced yesterday

READMEChangelog (1)Dependencies (2)Versions (4)Used By (0)

http-utils
==========

[](#http-utils)

This library is a very simple collection of a few classes to facilitate handling HTTP requests.

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

[](#installation)

Available as composer package `femastudios/http-utils`. PHP 7.3 or greater required.

Contents &amp; Usage
--------------------

[](#contents--usage)

### Core

[](#core)

Very base classes. Enumerators are declared using the [femastudios/enums](https://github.com/femastudios/enums) library.

- [`HttpRequestMethod`](https://github.com/femastudios/http-utils/blob/master/src/HttpRequestMethod.php): enumerator that defines the common request methods (`GET`, `POST`, etc.). They also have some properties (e.g. is cachable)
- [`HttpResponseCode`](https://github.com/femastudios/http-utils/blob/master/src/HttpResponseCode.php): enumerator that defines the common response codes (`SUCCESS`, `NOT_FOUND`, `FORBIDDEN`, etc.). They have the numerical code and the standard message.
- [`HttpResponseCodeType`](https://github.com/femastudios/http-utils/blob/master/src/HttpResponseCodeType.php): enumerator that defines the type of a response code (i.e. `INFORMATIONAL`, `SUCCESSFUL`, `REDIRECTION`, `CLIENT_ERROR` and `SERVER_ERROR`)
- [`HttpException`](https://github.com/femastudios/http-utils/blob/master/src/HttpException.php): exception class that wraps an `HttpResponseCode` enum, useful to bubble up an HTTP response code that need to be handled at a higher level.

### Header utils

[](#header-utils)

These utilities allow to better handle request and response HTTP headers.

- [`RequestHeaderUtils`](https://github.com/femastudios/http-utils/blob/master/src/headers/RequestHeaderUtils.php): contains functions to read the headers sent by the requester (even in a context that does not define `getallheaders()`, like FPM).
- [`ResponseHeaderUtils`](https://github.com/femastudios/http-utils/blob/master/src/headers/ResponseHeaderUtils.php): contains functions to add and read headers to be sent, also with support of comma-separated values (that can be added in different calls).

Example usage:

```
RequestHeaderUtils::get('Content-Type', 'none'); // Get the header, or default value

ResponseHeaderUtils::put('Content-Type', 'application/json'); // Put the header or throws if they have already been sent
ResponseHeaderUtils::addCsv('Vary', 'Origin'); // Treats the header value as a comma-separated value and adds "Origin"
```

### Uploaded files utils

[](#uploaded-files-utils)

Here we have utilities that help handling file uploads. The main reason for this utility is:

1. Handle the errors with an exception;
2. Untangle the mess that is the `$_FILES` array when the param name is nested (e.g. `user[info][avatar]`). For more on this see the doc of [`UploadedFilesUtils::getReorderedFiles()`](https://github.com/femastudios/http-utils/blob/master/src/files/UploadedFilesUtils.php#L14-L110).

The classes are:

- [`UploadedFile`](https://github.com/femastudios/http-utils/blob/master/src/files/UploadedFile.php): class that contains the info on a single uploaded file (e.g. name, size, etc.)
- [`UploadedFileException`](https://github.com/femastudios/http-utils/blob/master/src/files/UploadedFileException.php): exception thrown when an error uploading a file is detected. It cotains the error code and a description of the error as message.
- [`UploadedFilesUtils`](https://github.com/femastudios/http-utils/blob/master/src/files/UploadedFilesUtils.php): contains static functions to retrieve the uploaded files

Example usage:

```
$uf = UploadedFilesUtils::getUploadedFile('user', 'info', 'avatar'); // Returns an UploadedFile or throws UploadedFileException
$uf->getTmpName(); // Return the file temp filename (e.g. /tmp/php1324.tmp)
```

###  Health Score

33

—

LowBetter than 75% of packages

Maintenance54

Moderate activity, may be stable

Popularity9

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity52

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

Total

2

Last Release

1771d ago

PHP version history (2 changes)v1.0.0PHP ^7.3

v1.0.1PHP &gt;=7.3

### Community

Maintainers

![](https://www.gravatar.com/avatar/648242597974310b48d5146550fcce17701fdefb2ef9858bcd55ea8f439f79eb?d=identicon)[FEMAStudios](/maintainers/FEMAStudios)

---

Top Contributors

[![MMauro94](https://avatars.githubusercontent.com/u/21290655?v=4)](https://github.com/MMauro94 "MMauro94 (1 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/femastudios-http-utils/health.svg)

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

###  Alternatives

[friendsofsymfony/rest-bundle

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

2.8k73.3M319](/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.8M293](/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)
