PHPackages                             kwattro/hypermedia-collection-json - 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. [API Development](/categories/api)
4. /
5. kwattro/hypermedia-collection-json

ActiveLibrary[API Development](/categories/api)

kwattro/hypermedia-collection-json
==================================

Hypermedia Collection+Json Library for PHP

01PHP

Since Aug 27Pushed 11y agoCompare

[ Source](https://github.com/kwattro/hypermedia-collection-json-php)[ Packagist](https://packagist.org/packages/kwattro/hypermedia-collection-json)[ RSS](/packages/kwattro-hypermedia-collection-json/feed)WikiDiscussions master Synced 4w ago

READMEChangelogDependenciesVersions (1)Used By (0)

PHP Library for handling Hypermedia Collection+Json Format
==========================================================

[](#php-library-for-handling-hypermedia-collectionjson-format)

! WIP Status

Link to the Collection+Json Specification :

### Installation

[](#installation)

Add the library to your composer.json file

```
{
    "require": {
        // your other deps,
        "kwattro/hypermedia-collection-json": "0.1@dev"
    }
}
```

### Usage

[](#usage)

Usage of the library is simple :

#### Create a new Collection :

[](#create-a-new-collection-)

```
require_once 'vendor/autoload.php';

use Kwattro\Hypermedia\CollectionJson\Collection;

$collection = new Collection();
$collection->addHref('http://example.com/api/movies');
```

#### Add items to the collection

[](#add-items-to-the-collection)

```
use Kwattro\Hypermedia\CollectionJson\Collection;
use Kwattro\Hypermedia\CollectionJson\Item;

$collection = new Collection();
$item = new Item();
$item->addData(array('name' => 'John', 'city' => 'Paradise City');
$item->addHref('http://example.com/user/1234/john');
$collection->addItem($item);
```

### (De-)Serializing

[](#de-serializing)

In order to serialize/deserialize objects, you just need to call the Serializer create static method :

```
use Kwattro\Hypermedia\CollectionJson\Serializer;

// $myCollection = ... creating collection and items objects

$json = Serializer::create()->serialize($myCollection); // Returns a Json representation

// Deserializing :
$myObject = Serializer::create()->deserialize($json); // Returns a Collection object
```

### Tests

[](#tests)

The lib is using `phpspec`

#### Running the test suite

[](#running-the-test-suite)

```
bin/phpspec run

```

### TO-DO

[](#to-do)

- Implementing JMS/Serializer (partially done)
- Full compliant with Hypermedia Spec

###  Health Score

19

—

LowBetter than 10% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity1

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity41

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.

### Community

Maintainers

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

---

Top Contributors

[![ikwattro](https://avatars.githubusercontent.com/u/1222009?v=4)](https://github.com/ikwattro "ikwattro (2 commits)")

### Embed Badge

![Health badge](/badges/kwattro-hypermedia-collection-json/health.svg)

```
[![Health](https://phpackages.com/badges/kwattro-hypermedia-collection-json/health.svg)](https://phpackages.com/packages/kwattro-hypermedia-collection-json)
```

###  Alternatives

[stripe/stripe-php

Stripe PHP Library

4.0k143.3M474](/packages/stripe-stripe-php)[twilio/sdk

A PHP wrapper for Twilio's API

1.6k92.9M270](/packages/twilio-sdk)[knplabs/github-api

GitHub API v3 client

2.2k15.8M186](/packages/knplabs-github-api)[facebook/php-business-sdk

PHP SDK for Facebook Business

90121.9M33](/packages/facebook-php-business-sdk)[microsoft/microsoft-graph

The Microsoft Graph SDK for PHP

65723.5M95](/packages/microsoft-microsoft-graph)[meilisearch/meilisearch-php

PHP wrapper for the Meilisearch API

73813.7M114](/packages/meilisearch-meilisearch-php)

PHPackages © 2026

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