2017 © Pedro Peláez
 

library json-api-client

Abstract client-side php implementation of the json api specification (jsonapi.org)

image

enm/json-api-client

Abstract client-side php implementation of the json api specification (jsonapi.org)

  • Tuesday, March 6, 2018
  • by eosnewmedia
  • Repository
  • 5 Watchers
  • 5 Stars
  • 3,705 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 2 Forks
  • 1 Open issues
  • 7 Versions
  • 55 % Grown

The README.md

JSON API Client

Build Status, (*1)

Abstract client-side PHP implementation of the json api specification., (*2)

Installation

composer require enm/json-api-client

It's recommended to install kriswallsmith/buzz as http-client and nyholm/psr7 for http factories., (*3)

composer require kriswallsmith/buzz nyholm/psr7

You can also use any HTTP client which implements PSR-18., (*4)

Usage

First you should read the docs at enm/json-api-common where all basic structures are defined., (*5)

Your API client is an instance of Enm\JsonApi\Client\JsonApiClient, which requires a PSR-18 HTTP client (Psr\Http\Client\ClientInterface) to execute requests., (*6)


$client = new JsonApiClient( 'http://example.com/api', $httpClient, // instance of Psr\Http\Client\ClientInterface $uriFactory, // instance of Psr\Http\Message\UriFactoryInterface $requestFactory, // instance of Psr\Http\Message\RequestFactoryInterface $streamFactory, // instance of Psr\Http\Message\StreamFactoryInterface new Serializer(), new Deserializer() ); $request = $client->createGetRequest(new Uri('/myResources/1')); // will fetch the resource at http://example.com/api/myResources/1 $request->requestInclude('myRelationship'); // include a relationship $response = $client->execute($request); $document = $response->document(); $myResource = $document->data()->first(); // the resource fetched by this request $myIncludedResources = $document->included()->all(); // the included resources fetched with the include parameter

The Versions

06/03 2018

dev-master

9999999-dev

Abstract client-side php implementation of the json api specification (jsonapi.org)

  Sources   Download

MIT

The Requires

 

The Development Requires

by Philipp Marien

06/03 2018

1.2.0

1.2.0.0

Abstract client-side php implementation of the json api specification (jsonapi.org)

  Sources   Download

MIT

The Requires

 

The Development Requires

by Philipp Marien

06/03 2018

dev-develop

dev-develop

Abstract client-side php implementation of the json api specification (jsonapi.org)

  Sources   Download

MIT

The Requires

 

The Development Requires

by Philipp Marien

20/02 2018

1.1.0

1.1.0.0

Abstract client-side php implementation of the json api specification (jsonapi.org)

  Sources   Download

MIT

The Requires

 

The Development Requires

by Philipp Marien

27/12 2017

1.0.2

1.0.2.0

Abstract client-side php implementation of the json api specification (jsonapi.org)

  Sources   Download

MIT

The Requires

 

The Development Requires

by Philipp Marien

21/11 2017

1.0.1

1.0.1.0

Abstract client-side php implementation of the json api specification (jsonapi.org)

  Sources   Download

MIT

The Requires

 

The Development Requires

by Philipp Marien

20/07 2017

1.0.0

1.0.0.0

Abstract client-side php implementation of the json api specification (jsonapi.org)

  Sources   Download

MIT

The Requires

 

The Development Requires

by Philipp Marien