1. Go to this page and download the library: Download mvieira/collection-json 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/ */
mvieira / collection-json example snippets
$collection = (new Collection())
->withItem((new Item('https://example.co/item/1'))
->withDataSet([
new Data('data 1'),
new Data('data 2', 'value 2')
])
->withLink(
new Link('https://example.co/item/1', Relation::ITEM)
)
);
print json_encode($collection);