2017 © Pedro Peláez
 

library hal

Provides HAL json/xml support

image

joshuaestes/hal

Provides HAL json/xml support

  • Saturday, April 27, 2013
  • by joshuaestes
  • Repository
  • 0 Watchers
  • 0 Stars
  • 394 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

Hal/Hal package

This package is used to create hal json. It's quick and dirty and the only reason it exists is for my own education. Feel free to use it., (*1)

Usage

<?php

use JoshuaEstes\Hal\Link;
use JoshuaEstes\Hal\Resource;

// This is required, you need to give the location of where the user is at
$resource = new Resource(new Link('/location', 'self'));

// Define a new resource
$productResource        = new Resource(new Link('/product/123', 'self'), 'products');
$productResource->title = 'Test Product';

// Add the resource to your main resource
$resource->addResource($productResource);

// You can add more links too
$resource->addLink(new Link('/location/next', 'next'));
$resource->addLink(new Link('/location/previous', 'previous'));

// Now you can dump the json
echo $resource->asJson();

Testing

Be sure to install composer.phar, (*2)

php composer.phar install --dev
php bin/phpunit

The Versions

27/04 2013

dev-master

9999999-dev https://github.com/JoshuaEstes/hal

Provides HAL json/xml support

  Sources   Download

MIT

The Development Requires

json xml hal