PHPackages                             danbelden/php-siren - 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. danbelden/php-siren

ActiveLibrary

danbelden/php-siren
===================

A PHP Library for handling Siren JSON hypermedia

v1.0.3(6y ago)15.6k[1 issues](https://github.com/danbelden/php-siren/issues)MITPHPPHP &gt;=5.3

Since May 14Pushed 6y agoCompare

[ Source](https://github.com/danbelden/php-siren)[ Packagist](https://packagist.org/packages/danbelden/php-siren)[ RSS](/packages/danbelden-php-siren/feed)WikiDiscussions master Synced 2d ago

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

danbelden/php-siren
===================

[](#danbeldenphp-siren)

[![Build Status](https://camo.githubusercontent.com/c047da4e778f132fe8f305e08fed8a26935591f86e0af7b50c2eb423722fe511/68747470733a2f2f7472617669732d63692e6f72672f64616e62656c64656e2f7068702d736972656e2e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/danbelden/php-siren)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/1853bd6cd828f306fe46cb3cabcd24bd5e9781e03e7d1ec0fbd8afb8414fe9eb/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f64616e62656c64656e2f7068702d736972656e2f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/danbelden/php-siren/?branch=master)[![Maintainability](https://camo.githubusercontent.com/ec9035867d8825710a42d301894545c85c30b1bf89e867920baf5424430789e3/68747470733a2f2f6170692e636f6465636c696d6174652e636f6d2f76312f6261646765732f36666235303063343135653165363261333762352f6d61696e7461696e6162696c697479)](https://codeclimate.com/github/danbelden/php-siren/maintainability)[![Latest Stable Version](https://camo.githubusercontent.com/b9dda1e38a39072ed02b04c90b922f25b89b94a880ebb51b9945713b44059b1b/68747470733a2f2f706f7365722e707567782e6f72672f64616e62656c64656e2f7068702d736972656e2f76657273696f6e2e737667)](https://packagist.org/packages/danbelden/php-siren)[![Total Downloads](https://camo.githubusercontent.com/3cc74529e737dd75b53fbc1e0e5aeb3072e527ff6f133fb3b8f0da7c6aadd1b5/68747470733a2f2f706f7365722e707567782e6f72672f64616e62656c64656e2f7068702d736972656e2f646f776e6c6f6164732e737667)](https://packagist.org/packages/danbelden/php-siren)

A PHP Library for handling Siren JSON hypermedia documents

Overview
========

[](#overview)

This is a library based around the Siren hypermedia data standard:

-
-

It provides objects and validation for handling this structured data format.

Requires
========

[](#requires)

PHP 5.3 and above.

Installation
============

[](#installation)

Composer
--------

[](#composer)

To install this package with composer, run the following command:

`composer require danbelden/php-siren "^1.0"`

Documentation
=============

[](#documentation)

Using the example target JSON defined in the standards:

-

```
$document = new Document();
$document->addClass('order');

$properties = [
    'orderNumber' => 42,
    'itemCount'   => 3,
    'status'      => 'pending'
];
$document->setProperties($properties);

$entityOne = new Entity();
$entityOne->setClass([ 'items', 'collection' ])
    ->setRel([ 'http://x.io/rels/order-items' ])
    ->setHref('http://api.x.io/orders/42/items');

$entityTwoLink = new Link();
$entityTwoLink->setRel([ 'self' ])
    ->setHref('http://api.x.io/customers/pj123');

$entityTwo = new Entity();
$entityTwo->setClass([ 'info', 'customer' ])
    ->setRel([ 'http://x.io/rels/customer' ])
    ->setProperties([
        'customerId' => 'pj123',
        'name' => 'Peter Joseph'
    ])
    ->setLinks([ $entityTwoLink ]);

$entities = [ $entityOne, $entityTwo ];
$document->setEntities($entities);

$actionFieldOne = new Field();
$actionFieldOne->setName('orderNumber')
    ->setType('hidden')
    ->setValue('42');

$actionFieldTwo = new Field();
$actionFieldTwo->setName('productCode')
    ->setType('text');

$actionFieldThree = new Field();
$actionFieldThree->setName('quantity')
    ->setType('number');

$actionOne = new Action();
$actionOne->setName('add-item')
    ->setTitle('Add Item')
    ->setMethod('POST')
    ->setHref('http://api.x.io/orders/42/items')
    ->setType('application/x-www-form-urlencoded')
    ->setFields([ $actionFieldOne, $actionFieldTwo, $actionFieldThree ]);

$actions = [ $actionOne ];
$document->setActions($actions);

$linkOne = new Link();
$linkOne->setRel([ 'self' ])
    ->setHref('http://api.x.io/orders/42');

$linkTwo = new Link();
$linkTwo->setRel([ 'previous' ])
    ->setHref('http://api.x.io/orders/41');

$linkThree = new Link();
$linkThree->setRel([ 'next' ])
    ->setHref('http://api.x.io/orders/43');

$links = [ $linkOne, $linkTwo, $linkThree ];
$document->setLinks($links);

```

Enjoy.

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance0

Infrequent updates — may be unmaintained

Popularity20

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity61

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

Total

4

Last Release

2511d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/130d2308b18404b8b59362d67b31b1525d68052696bd257174a0516edb26f9ab?d=identicon)[DanBelden](/maintainers/DanBelden)

---

Top Contributors

[![danbelden](https://avatars.githubusercontent.com/u/956479?v=4)](https://github.com/danbelden "danbelden (11 commits)")

---

Tags

composerhypermediajsonphp-librarysiren

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/danbelden-php-siren/health.svg)

```
[![Health](https://phpackages.com/badges/danbelden-php-siren/health.svg)](https://phpackages.com/packages/danbelden-php-siren)
```

PHPackages © 2026

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