mauro-moreno/silex-jsonapi

JSONApi.org implementation for Silex framework.

2.0.2 2016-09-05 13:20 UTC

This package is auto-updated.

Last update: 2022-07-28 20:07:52 UTC


README

JSONApi.org implementation for Silex framework.

Based on Nil Portugués Caldero PHP Json Api Package php-json-api.

Installation

** Step 1: Download Service Provider

To install with composer just open a terminal and type:

$ composer require mauro-moreno/silex-jsonapi

** Step 2: Enable Service Provider

To enable

<?php
$app = new Silex\Application;
$app['mappers'] = []; // Array of mapping classes
$app->register(new MauroMoreno\JsonApi\JsonApiServiceProvider);

Controller

The following JsonApiResponseTrait methods are provided to return the right headers and HTTP status codes are available:

    private function resourceCreated($json);
    private function resourceDeleted($json);
    private function resourceNotFound($json);
    private function resourceProcessing($json);
    private function resourceUpdatedResponse($json);
    private function response($json);
    private function unsupportedAction($json);