2017 © Pedro Peláez
 

library mason-php

PHP library for generating Mason hypermedia documents

image

phonecom/mason-php

PHP library for generating Mason hypermedia documents

  • Wednesday, June 15, 2016
  • by curtisdf
  • Repository
  • 8 Watchers
  • 19 Stars
  • 171 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 19 Versions
  • 0 % Grown

The README.md

Mason PHP

Build Status Latest Stable Version Total Downloads Latest Unstable Version License, (*1)

This project provides a PHP tool for building Hypermedia REST API's in Mason format., (*2)

At present, it includes a set of Mason Builder classes for producing data structures that can be passed to json_encode() for rendering Mason response bodies., (*3)

Example

Here is a simple example:, (*4)

<?php
use PhoneCom\Mason\Builder\Document;

$doc = new Document([
    'first_name' => 'Oscar',
    'last_name' => 'Grouch',
    'birthday' => 'Apr 1',
    'address' => 'Sesame Street'
]);

$doc->addMetaProperty('@title', 'Oscar the Grouch')
    ->setProperty('clothing', 'Trash can')
    ->setControl('self', 'http://example.com/characters/oscar');

echo json_encode($doc);

This produces the following data structure:, (*5)

{
    "first_name": "Oscar",
    "last_name": "Grouch",
    "birthday": "Apr 1",
    "address": "Sesame Street",
    "clothing": "Trash can",
    "@meta": {
        "@title": "Oscar the Grouch"
    },
    "@controls": {
        "self": {
            "href": "http://example.com/characters/oscar"
        }
    }
}

Motivation

Mason is a Hypermedia RESTful API format first published in 2013 by Jørn Wildt. It combines lessons learned from years of API implementations and close study of other competing formats such as Hal, Collection+JSON, and JSON-LD. Each format has its strengths, but none has the desired balance of simplicity and features., (*6)

Mason-PHP was built to help promote Mason adoption within the PHP community, and to provide much needed tooling., (*7)

Installation

This project is integrated with Composer. You can put it in your composer.json as a dependency:, (*8)

"require": {
    "phonecom/mason-laravel": "1.*"
}

Usage

Documentation is forthcoming. All public methods are documented inline, so at the moment, the best way to learn is to browse the code., (*9)

Tests

Run phpunit in the top folder. If you have the XDebug extension installed, you may also run it with the Code Coverage config which is provided separately, e.g. phpunit -c phpunit-coverage-html.xml, (*10)

Contributors

This project was created and is managed by Phone.com. We're building a hot new Hypermedia API and we chose Mason!, (*11)

Pull requests are welcome., (*12)

License

This project is released under the MIT License. Copyright (c) 2015 Phone.com, Inc. See LICENSE for full details., (*13)

The Versions

15/06 2016

dev-test-versioned-paths

dev-test-versioned-paths

PHP library for generating Mason hypermedia documents

  Sources   Download

MIT

The Requires

  • php >=5.5

 

The Development Requires

by Curtis Farnham

rest hypermedia mason

28/03 2016

dev-master

9999999-dev

PHP library for generating Mason hypermedia documents

  Sources   Download

MIT

The Requires

  • php >=5.5

 

The Development Requires

by Curtis Farnham

rest hypermedia mason

28/03 2016

1.10.0

1.10.0.0

PHP library for generating Mason hypermedia documents

  Sources   Download

MIT

The Requires

  • php >=5.5

 

The Development Requires

by Curtis Farnham

rest hypermedia mason

28/03 2016

1.9.1

1.9.1.0

PHP library for generating Mason hypermedia documents

  Sources   Download

MIT

The Requires

  • php >=5.5

 

The Development Requires

by Curtis Farnham

rest hypermedia mason

27/03 2016

1.9.0

1.9.0.0

PHP library for generating Mason hypermedia documents

  Sources   Download

MIT

The Requires

  • php >=5.5

 

The Development Requires

by Curtis Farnham

rest hypermedia mason

23/03 2016

1.8.1

1.8.1.0

PHP library for generating Mason hypermedia documents

  Sources   Download

MIT

The Requires

  • php >=5.5

 

The Development Requires

by Curtis Farnham

rest hypermedia mason

11/08 2015

1.8.0

1.8.0.0

PHP library for generating Mason hypermedia documents

  Sources   Download

MIT

The Requires

  • php >=5.5

 

The Development Requires

by Curtis Farnham

rest hypermedia mason

11/08 2015

1.7.0

1.7.0.0

PHP library for generating Mason hypermedia documents

  Sources   Download

MIT

The Requires

  • php >=5.5

 

The Development Requires

by Curtis Farnham

rest hypermedia mason

10/08 2015

1.6.2

1.6.2.0

PHP library for generating Mason hypermedia documents

  Sources   Download

MIT

The Requires

  • php >=5.5

 

The Development Requires

by Curtis Farnham

rest hypermedia mason

03/08 2015

1.5.0

1.5.0.0

PHP library for generating Mason hypermedia documents

  Sources   Download

MIT

The Requires

  • php >=5.5

 

The Development Requires

by Curtis Farnham

rest hypermedia mason

29/07 2015

1.4.1

1.4.1.0

PHP library for generating Mason hypermedia documents

  Sources   Download

MIT

The Requires

  • php >=5.5

 

The Development Requires

by Curtis Farnham

rest hypermedia mason

22/07 2015

1.4.0

1.4.0.0

PHP library for generating Mason hypermedia documents

  Sources   Download

MIT

The Requires

  • php >=5.5

 

The Development Requires

by Curtis Farnham

rest hypermedia mason

21/07 2015

1.3.0

1.3.0.0

PHP library for generating Mason hypermedia documents

  Sources   Download

MIT

The Requires

  • php >=5.5

 

The Development Requires

by Curtis Farnham

rest hypermedia mason

17/07 2015

1.2.0

1.2.0.0

PHP library for generating Mason hypermedia documents

  Sources   Download

MIT

The Requires

  • php >=5.5

 

The Development Requires

by Curtis Farnham

rest hypermedia mason

13/07 2015

1.1.1

1.1.1.0

PHP library for generating Mason hypermedia documents

  Sources   Download

MIT

The Requires

  • php >=5.5

 

The Development Requires

by Curtis Farnham

rest hypermedia mason

09/07 2015

1.1.0

1.1.0.0

PHP library for generating Mason hypermedia documents

  Sources   Download

MIT

The Requires

  • php >=5.5

 

The Development Requires

by Curtis Farnham

rest hypermedia mason

06/07 2015

1.0.2

1.0.2.0

PHP library for generating Mason hypermedia documents

  Sources   Download

MIT

The Development Requires

by Curtis Farnham

mason

06/07 2015

1.0.1

1.0.1.0

PHP library for generating Mason hypermedia documents

  Sources   Download

MIT

The Development Requires

by Curtis Farnham

mason

06/07 2015

1.0.0

1.0.0.0

PHP library for generating Mason hypermedia documents

  Sources   Download

MIT

The Development Requires

by Curtis Farnham

mason