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

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

frootbox/http
=============

Frootbox Http Library

0.4.3(1mo ago)03.1k1GPL-3.0-or-laterPHPPHP &gt;=8.2CI failing

Since Jun 13Pushed 1mo agoCompare

[ Source](https://github.com/Frootbox/Http)[ Packagist](https://packagist.org/packages/frootbox/http)[ RSS](/packages/frootbox-http/feed)WikiDiscussions master Synced today

READMEChangelogDependencies (3)Versions (14)Used By (1)

Frootbox HTTP
=============

[](#frootbox-http)

General-purpose HTTP helpers for Frootbox projects.

The package provides small wrappers around request data, simple response and stream objects, and a URL sanitizing trait. It targets PHP 8.2 and newer.

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

[](#installation)

```
composer require frootbox/http
```

Request Data
------------

[](#request-data)

`Get`, `Post`, and `Patch` extend `AbstractHttpData` and expose the same access helpers for HTTP payloads.

```
use Frootbox\Http\Post;

$post = new Post();

$title = $post->get('Title');
$countryId = $post->getIntWithDefault('CountryId');
$isActive = $post->getBoolean('Active');
```

String values returned by `get()` are trimmed. Missing attributes return `null`.

### Defaults and Nested Values

[](#defaults-and-nested-values)

```
$post = new Post([
    'Title' => ' Example ',
    'Address' => [
        'City' => 'Amsterdam',
    ],
]);

$title = $post->getWithDefault('Title', 'Untitled');
$city = $post->getPath('Address.City');
```

`getPath()` resolves dot-separated paths and returns `null` when any segment is missing.

### Required Input

[](#required-input)

```
$post->require(['Title', 'Address.City']);
$post->requireOne(['Email', 'Phone']);
```

Both methods return the current instance when validation succeeds and throw `Frootbox\Exceptions\InputMissing` when the required input is not present.

`validate()` is deprecated and delegates to `require()`.

Query Data
----------

[](#query-data)

`Get` reads from `$_GET` and can be adjusted in tests or small scripts:

```
use Frootbox\Http\Get;

$get = new Get();
$get->set('page', 2);
```

Post Data
---------

[](#post-data)

`Post` reads from `$_POST` by default. Pass an array to work with explicit data:

```
use Frootbox\Http\Post;

$post = new Post([
    'CountryId' => '5',
]);
```

Patch Data
----------

[](#patch-data)

`Patch` parses `php://input` with `parse_str()` and exposes the parsed values via the same `AbstractHttpData` helpers.

Responses
---------

[](#responses)

`Response` is a lightweight response object for building headers, status and a body before flushing them to PHP output.

```
use Frootbox\Http\Response;

$response = (new Response())
    ->withStatus(201)
    ->setHeader('Content-Type', 'application/json');

$response->setBody(json_encode(['ok' => true]));
$response->flush();
```

URL Sanitizing
--------------

[](#url-sanitizing)

Use `UrlSanitize` to build URL-safe slugs from labels:

```
use Frootbox\Http\Traits\UrlSanitize;

final class Slugger
{
    use UrlSanitize;
}

$slug = (new Slugger())->getStringUrlSanitized('Äpfel & Öl');
// aepfel-und-oel
```

German is used as the default language for ampersand replacement. Dutch can be selected with `nl-NL`.

Tests
-----

[](#tests)

```
composer install
vendor/bin/phpunit
```

Some PSR-7 related tests are currently marked as skipped because the corresponding methods are placeholders.

License
-------

[](#license)

GPL-3.0-or-later

###  Health Score

51

—

FairBetter than 95% of packages

Maintenance90

Actively maintained with recent releases

Popularity20

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity69

Established project with proven stability

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

Recently: every ~21 days

Total

13

Last Release

46d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/fcec2f1b7299cf187eff1364cf8d442431845a14e202900c2756929f5ff36432?d=identicon)[82912759](/maintainers/82912759)

---

Top Contributors

[![JnHbbBrnng](https://avatars.githubusercontent.com/u/45029139?v=4)](https://github.com/JnHbbBrnng "JnHbbBrnng (30 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  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)
