PHPackages                             tomphp/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. [API Development](/categories/api)
4. /
5. tomphp/siren

AbandonedArchivedLibrary[API Development](/categories/api)

tomphp/siren
============

A library for creating and parsing Siren APIs in PHP

v0.1.0(9y ago)317511MITPHPPHP ^7.0

Since Dec 5Pushed 6y ago1 watchersCompare

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

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

Siren
=====

[](#siren)

A serialiser and parser for [Siren](https://github.com/kevinswiber/siren) APIs.

Siren
-----

[](#siren-1)

Siren is a schema for HATEOAS APIs which uses JSON.

Current State
-------------

[](#current-state)

This project's releases strongly adhere to SemVer. At this point in time, this project is in zero point state. While it's functionality is sound and working, large backwards compatibility breaks can be expected in new releases.

Installing
----------

[](#installing)

```
composer require tomphp/siren:dev-master

```

Serialising
-----------

[](#serialising)

Creating an entity is done using the builder; this is created by calling `TomPHP\Siren\Entity::builder()`.

```
use TomPHP\Siren\{Entity, Action};

$editAction = Action::builder()
    ->setName('edit')
    ->setTitle('Edit User')
    ->setHref('http://example.com/api/v1/users/ea019642-9c53-415f-88b6-e191dea184f9')
    ->setMethod('PUT')
    ->setType('application/vnd.siren+json')
    ->addField('email', ['email-class'], 'email', 'test@example.com', 'Email Address')
    ->build();

$user = Entity::builder()
    ->addLink('self', 'http://example.com/api/v1/users/ea019642-9c53-415f-88b6-e191dea184f9')
    ->addProperty('full_name', 'Tom Oram')
    ->addProperty('email', 'tom@example.com')
    ->addClass('item')
    ->addAction($editAction)
    ->build();

print(json_encode($user->toArray());
```

Parsing
-------

[](#parsing)

An entity can be created from a JSON decoded array by using `fromArray()`constructor.

```
// Assuming the JSON from the serialising example.

$user = Entity::fromArray(json_decode($json, true));

echo 'Name: ' . $user->getProperty('full_name') . PHP_EOL;
echo 'Email: ' . $user->getProperty('email') . PHP_EOL;

$editAction = $user->getAction('edit');
echo 'Edit Action ' . $editAction->getMehod() . ' ' . $editAction->getHref() . PHP_EOL;
```

Contributing
------------

[](#contributing)

I want to get this project stable as soon as possible, so any help I can get is greatly appreciated. If you think you can help, please submit a Pull Request.

###  Health Score

26

—

LowBetter than 41% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity15

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity48

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 91.5% 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

Unknown

Total

1

Last Release

3495d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/1959183?v=4)[Tom Oram](/maintainers/tomphp)[@tomphp](https://github.com/tomphp)

---

Top Contributors

[![tomphp](https://avatars.githubusercontent.com/u/1959183?v=4)](https://github.com/tomphp "tomphp (54 commits)")[![milgner](https://avatars.githubusercontent.com/u/160025?v=4)](https://github.com/milgner "milgner (5 commits)")

###  Code Quality

TestsPHPUnit

Code StylePHP CS Fixer

### Embed Badge

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

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

###  Alternatives

[symfony/symfony

The Symfony PHP framework

31.4k87.2M2.2k](/packages/symfony-symfony)[flix-tech/confluent-schema-registry-api

A PHP 7.4+ library to consume the Confluent Schema Registry REST API.

484.4M3](/packages/flix-tech-confluent-schema-registry-api)[dfridrich/ares

Communication with ARES (Czech business register)

24401.8k2](/packages/dfridrich-ares)[taluu/behapi

Test your remote api locally through Behat

3212.6k](/packages/taluu-behapi)[lmc/matej-client

API Client for Matej recommendation engine

1164.4k](/packages/lmc-matej-client)[armetiz/airtable-php

Manipulate Airtable API using PHP

209.2k](/packages/armetiz-airtable-php)

PHPackages © 2026

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