PHP code example of jefersondaniel / siren-php

1. Go to this page and download the library: Download jefersondaniel/siren-php library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

jefersondaniel / siren-php example snippets


$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;