jefersondaniel / siren-php
Siren hypermedia type implementation for PHP
Installs: 555
Dependents: 0
Suggesters: 0
Security: 0
Stars: 9
Watchers: 2
Forks: 4
Open Issues: 0
pkg:composer/jefersondaniel/siren-php
Requires
- php: >=5.3.0
README
Siren hypermedia type implementation for PHP
Introduction
Siren is a hypermedia specification for representing entities. As HTML is used for visually representing documents on a Web site, Siren is a specification for presenting entities via a Web API. Siren offers structures to communicate information about entities, actions for executing state transitions, and links for client navigation.
Installing with composer
composer.phar require jefersondaniel/siren-php
Encoding a resource
$collection = new SirenPHP\Entity( '/collection/1', ['count' => 3], ['collection'] ); $entity = new SirenPHP\Entity( '/book/1', ['name' => 'The Book 1'], ['book'] ); $collection->appendEntity(['item'], $entity); $link = new SirenPHP\Link(['next'], '/collection/2'); $collection->appendLink($link); echo (string) $collection;