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

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

wunderwerkio/http-api-utils
===========================

Set of useful HTTP API utilities. Provides json schema validation and error handling.

1.1.0(2mo ago)03.2k↓44.4%1[2 PRs](https://github.com/wunderwerkio/http-api-utils/pulls)MITPHPCI passing

Since Apr 3Pushed 2mo ago2 watchersCompare

[ Source](https://github.com/wunderwerkio/http-api-utils)[ Packagist](https://packagist.org/packages/wunderwerkio/http-api-utils)[ RSS](/packages/wunderwerkio-http-api-utils/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (1)Dependencies (6)Versions (8)Used By (0)

HTTP-API Utils
==============

[](#http-api-utils)

This package provides useful utilities for use with HTTP-APIs of any kind.

For response generation the `symfony/http-foundation` package is being used.

Install
-------

[](#install)

Install this package via composer:

```
composer require wunderwerkio/http-api-utils
```

Features
--------

[](#features)

### `HttpApiValidationTrait`

[](#httpapivalidationtrait)

The `HttpApiValidationTrait` provides methods to validate a data structure against a \[JSON Schema)(). The validation itself is done with the [`justinrainbow/json-schema`](https://github.com/justinrainbow/json-schema) package.

**Define the schema**:

```
$schema = [
  "type" => "object",
  "properties" => [
    "name" => [
      "type" => "string",
    ],
    "age" => [
      "type" => "integer",
    ],
  ],
  "required" => ["name"],
];
```

Depending on your input data, you can use different validation methods to suit your needs:

- `validateDataStructure`Accepts a reference to an object. This is meant to be used with results from `json_decode`.
- `validateArray`Accepts an array as the data to validate.
- `validateJsonString`Accepts a JSON encoded string.

**Example (with the schema from above)**:

```
$validData = (object) [
  'name' => 'Max',
  'age' => 42,
];

$result = $this->validateDataStructure($validData, $schema);

$result->isValid(); // -> TRUE

// With invalid data.

$invalidData = (object) [
  'age' => '42',
];

$result = $this->validateDataStructure($invalidData, $schema);

$result->isValid(); // -> FALSE
$result->getErrors(); // -> Array of validation errors.
$result->getResponse(); // -> JsonApiErrorResponse with the validation errors.
```

For more information, check out the JSON Schema package: .

###  Health Score

44

—

FairBetter than 92% of packages

Maintenance86

Actively maintained with recent releases

Popularity22

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity49

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

Total

4

Last Release

74d ago

Major Versions

0.1.1 → 1.0.02024-12-11

### Community

Maintainers

![](https://www.gravatar.com/avatar/4666e31b2b5affda25175084f83fb14aa226826e6b06c22094ae79e48c822568?d=identicon)[chfoidl](/maintainers/chfoidl)

---

Top Contributors

[![chfoidl](https://avatars.githubusercontent.com/u/12481286?v=4)](https://github.com/chfoidl "chfoidl (14 commits)")

---

Tags

composer-packagehttphttp-apiphp-libraryphp8symfony

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

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

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

###  Alternatives

[symfony/http-kernel

Provides a structured process for converting a Request into a Response

8.1k822.4M6.7k](/packages/symfony-http-kernel)[nelmio/api-doc-bundle

Generates documentation for your REST API from attributes

2.3k63.6M232](/packages/nelmio-api-doc-bundle)[api-platform/core

Build a fully-featured hypermedia or GraphQL API in minutes!

2.6k48.1M236](/packages/api-platform-core)[friendsofsymfony/http-cache-bundle

Set path based HTTP cache headers and send invalidation requests to your HTTP cache

43813.2M47](/packages/friendsofsymfony-http-cache-bundle)[illuminate/http

The Illuminate Http package.

11936.0M5.0k](/packages/illuminate-http)[api-platform/http-cache

API Platform HttpCache component

223.2M7](/packages/api-platform-http-cache)

PHPackages © 2026

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