2017 © Pedro Peláez
 

library json-api

An attempt to express JSON API specs (jsonapi.org) in object-oriented way as a set of PHP 7 classes

image

json-api-php/json-api

An attempt to express JSON API specs (jsonapi.org) in object-oriented way as a set of PHP 7 classes

  • Saturday, March 3, 2018
  • by f3ath
  • Repository
  • 5 Watchers
  • 120 Stars
  • 1,183 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 12 Forks
  • 3 Open issues
  • 33 Versions
  • 30 % Grown

The README.md

JSON API spec implemented in PHP 7. Immutable

The goal of this library is to ensure strict validity of JSON API documents being produced., (*1)

JSON:, (*2)

{
    "data": {
        "type": "articles",
        "id": "1",
        "attributes": {
            "title": "Rails is Omakase"
        },
        "relationships": {
            "author": {
                "data": {
                    "type": "people",
                    "id": "9"
                },
                "links": {
                    "self": "/articles/1/relationships/author",
                    "related": "/articles/1/author"
                }
            }
        }
    }
}

PHP:, (*3)

<?php
use JsonApiPhp\JsonApi\Attribute;
use JsonApiPhp\JsonApi\DataDocument;
use JsonApiPhp\JsonApi\Link\RelatedLink;
use JsonApiPhp\JsonApi\Link\SelfLink;
use JsonApiPhp\JsonApi\ResourceIdentifier;
use JsonApiPhp\JsonApi\ResourceObject;
use JsonApiPhp\JsonApi\ToOne;

echo json_encode(
    new DataDocument(
        new ResourceObject(
            'articles',
            '1',
            new Attribute('title', 'Rails is Omakase'),
            new ToOne(
                'author',
                new ResourceIdentifier('author', '9'),
                new SelfLink('/articles/1/relationships/author'),
                new RelatedLink('/articles/1/author')
            )
        )
    ),
    JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES
);

Installation

composer require json-api-php/json-api, (*4)

Documentation

First, take a look at the examples. All of them are runnable. - Simple Document (the same as above) - Extensive Compound Document, (*5)

The library API and use-cases are expressed in a comprehensive suite of tests. - Data Documents (containing primary data) - with a single Resource Object - with a single Resource Identifier - with null data - with multiple Resource Objects - with multiple Resource Identifiers - with a new Resource (no id) - Compound Documents - Error Documents - Meta Documents (containing neither data nor errors) - Pagination - Link Objects - JSON API Object - Meta Objects, (*6)

The Versions

03/03 2018

dev-master

9999999-dev

An attempt to express JSON API specs (jsonapi.org) in object-oriented way as a set of PHP 7 classes

  Sources   Download

MIT

The Requires

  • php >=7.2

 

The Development Requires

by Alexey Karapetov

03/03 2018

2.0.0

2.0.0.0

An attempt to express JSON API specs (jsonapi.org) in object-oriented way as a set of PHP 7 classes

  Sources   Download

MIT

The Requires

  • php >=7.2

 

The Development Requires

by Alexey Karapetov

03/03 2018

dev-f3ath-patch-2

dev-f3ath-patch-2

An attempt to express JSON API specs (jsonapi.org) in object-oriented way as a set of PHP 7 classes

  Sources   Download

MIT

The Requires

  • php >=7.2

 

The Development Requires

by Alexey Karapetov

03/03 2018

2.0.0-rc.2

2.0.0.0-RC2

An attempt to express JSON API specs (jsonapi.org) in object-oriented way as a set of PHP 7 classes

  Sources   Download

MIT

The Requires

  • php >=7.2

 

The Development Requires

by Alexey Karapetov

03/03 2018

dev-formatting

dev-formatting

An attempt to express JSON API specs (jsonapi.org) in object-oriented way as a set of PHP 7 classes

  Sources   Download

MIT

The Requires

  • php >=7.2

 

The Development Requires

by Alexey Karapetov

01/03 2018

2.0.0-rc.1

2.0.0.0-RC1

An attempt to express JSON API specs (jsonapi.org) in object-oriented way as a set of PHP 7 classes

  Sources   Download

MIT

The Requires

  • php >=7.2

 

The Development Requires

by Alexey Karapetov

27/02 2018

dev-f3ath-patch-1

dev-f3ath-patch-1

An attempt to express JSON API specs (jsonapi.org) in object-oriented way as a set of PHP 7 classes

  Sources   Download

MIT

The Requires

  • php >=7.2

 

The Development Requires

by Alexey Karapetov

27/02 2018

2.0.0-rc.0

2.0.0.0-RC0

An attempt to express JSON API specs (jsonapi.org) in object-oriented way as a set of PHP 7 classes

  Sources   Download

MIT

The Requires

  • php >=7.2

 

The Development Requires

by Alexey Karapetov

22/02 2018

1.0.2

1.0.2.0

An attempt to express JSON API specs (jsonapi.org) in object-oriented way as a set of PHP 7 classes

  Sources   Download

MIT

The Requires

  • php >=7.1

 

The Development Requires

by Alexey Karapetov

05/01 2018

v2.x-dev

2.9999999.9999999.9999999-dev

An attempt to express JSON API specs (jsonapi.org) in object-oriented way as a set of PHP 7 classes

  Sources   Download

MIT

The Requires

  • php >=7.

 

The Development Requires

by Alexey Karapetov

27/10 2017

1.0.1

1.0.1.0

An attempt to express JSON API specs (jsonapi.org) in object-oriented way as a set of PHP 7 classes

  Sources   Download

MIT

The Requires

  • php >=7.1

 

The Development Requires

by Alexey Karapetov

25/10 2017

1.0.0

1.0.0.0

An attempt to express JSON API specs (jsonapi.org) in object-oriented way as a set of PHP 7 classes

  Sources   Download

MIT

The Requires

  • php >=7.1

 

The Development Requires

by Alexey Karapetov

20/10 2017

1.0.0-beta3

1.0.0.0-beta3

An attempt to express JSON API specs (jsonapi.org) in object-oriented way as a set of PHP 7 classes

  Sources   Download

MIT

The Requires

  • php >=7.0

 

The Development Requires

by Alexey Karapetov

15/10 2017

1.0.0-beta2

1.0.0.0-beta2

An attempt to express JSON API specs (jsonapi.org) in object-oriented way as a set of PHP 7 classes

  Sources   Download

MIT

The Requires

  • php >=7.0

 

The Development Requires

by Alexey Karapetov

08/10 2017

1.0.0-beta1

1.0.0.0-beta1

An attempt to express JSON API specs (jsonapi.org) in object-oriented way as a set of PHP 7 classes

  Sources   Download

MIT

The Requires

  • php >=7.0

 

The Development Requires

by Alexey Karapetov

11/09 2017

1.0.0-beta0

1.0.0.0-beta

An attempt to express JSON API specs (jsonapi.org) in object-oriented way as a set of PHP 7 classes

  Sources   Download

MIT

The Requires

  • php >=7.0

 

The Development Requires

by Alexey Karapetov

09/09 2017

v1.x-dev

1.9999999.9999999.9999999-dev

An attempt to express JSON API specs (jsonapi.org) in object-oriented way as a set of PHP 7 classes

  Sources   Download

MIT

The Requires

  • php >=7.0

 

The Development Requires

by Alexey Karapetov

02/09 2017

0.7.0

0.7.0.0

An attempt to express JSON API specs (jsonapi.org) in object-oriented way as a set of PHP 7 classes

  Sources   Download

MIT

The Requires

  • php >=7.0

 

The Development Requires

by Alexey Karapetov

31/08 2017

0.6.1

0.6.1.0

An attempt to express JSON API specs (jsonapi.org) in object-oriented way as a set of PHP 7 classes

  Sources   Download

MIT

The Requires

  • php >=7.0

 

The Development Requires

by Alexey Karapetov

27/07 2017

v0.x-dev

0.9999999.9999999.9999999-dev

An attempt to express JSON API specs (jsonapi.org) in object-oriented way as a set of PHP 7 classes

  Sources   Download

MIT

The Requires

  • php >=7.0

 

The Development Requires

by Alexey Karapetov

27/07 2017

0.5.2

0.5.2.0

jsonapi.org

  Sources   Download

MIT

The Requires

  • php >=7.0

 

The Development Requires

by Alexey Karapetov

27/07 2017

0.5.1

0.5.1.0

jsonapi.org

  Sources   Download

MIT

The Requires

  • php >=7.0

 

The Development Requires

by Alexey Karapetov

01/04 2017

0.5.0

0.5.0.0

jsonapi.org

  Sources   Download

MIT

The Requires

  • php >=7.0

 

The Development Requires

by Alexey Karapetov

31/03 2017

0.4.0

0.4.0.0

jsonapi.org

  Sources   Download

MIT

The Requires

  • php >=7.0

 

The Development Requires

by Alexey Karapetov

31/03 2017

0.3.0

0.3.0.0

jsonapi.org

  Sources   Download

MIT

The Requires

  • php >=7.0

 

The Development Requires

by Alexey Karapetov

30/03 2017

0.2.3

0.2.3.0

jsonapi.org

  Sources   Download

MIT

The Requires

  • php >=7.0

 

The Development Requires

by Alexey Karapetov

30/03 2017

0.2.2

0.2.2.0

jsonapi.org

  Sources   Download

MIT

The Requires

  • php >=7.0

 

The Development Requires

by Alexey Karapetov

29/03 2017

0.2.1

0.2.1.0

jsonapi.org

  Sources   Download

MIT

The Requires

  • php >=7.0

 

The Development Requires

by Alexey Karapetov

29/03 2017

0.2.0

0.2.0.0

jsonapi.org

  Sources   Download

MIT

The Requires

  • php >=7.1

 

The Development Requires

by Alexey Karapetov

29/03 2017

0.1.0

0.1.0.0

jsonapi.org

  Sources   Download

MIT

The Requires

  • php >=7.1

 

The Development Requires

by Alexey Karapetov

29/03 2017

0.0.3

0.0.3.0

jsonapi.org

  Sources   Download

MIT

The Requires

  • php >=7.1

 

The Development Requires

by Alexey Karapetov

28/03 2017

0.0.2

0.0.2.0

jsonapi.org

  Sources   Download

MIT

The Requires

  • php >=7.0

 

The Development Requires

by Alexey Karapetov

28/03 2017

0.0.1

0.0.1.0

jsonapi.org

  Sources   Download

MIT

The Requires

  • php >=7.0

 

The Development Requires

by Alexey Karapetov