Last Updated | | Ratings | | Unique User Downloads | | Download Rankings |
2024-09-26 (6 months ago)  | | Not enough user ratings | | Total: 11 | | All time: 11,485 This week: 51 |
|
Description | | Author |
This package provides components to implement API based on JSON:API.
It provides classes and traits API developers can use to implement PHP-based APIs that implement the JSON:API specification.
Currently it provides classes and traits to implement action controllers, data providers, and data pagination. Innovation Award
 September 2024
Number 6 |
JSON:API is a specification used to design web services APIs using the JSON format to send requests and return responses.
This package provides many useful components to develop APIs based on JSON:API specification, thus reducing the effort to implement this kind of API.
Manuel Lemos |
| |
 |
|
Innovation award
 Nominee: 18x |
|
Example
<?php
defined('YII_DEBUG') or define('YII_DEBUG', true);
defined('YII_ENV') or define('YII_ENV', 'test');
require dirname(__DIR__, 3) . '/vendor/autoload.php';
require dirname(__DIR__, 3) . '/vendor/yiisoft/yii2/Yii.php';
$config = require dirname(__DIR__) . '/config/api.php';
(new yii\web\Application($config))->run();
|
Details
yii2-fractal Beta

The set of utils and actions for prepare Rest API accordingly JSON:Api https://jsonapi.org/format/
With https://fractal.thephpleague.com
Installation
composer require insolita/yii2-fractal
Usage
-
Add class `insolita\fractal\JsonApiBootstrap` to the ['bootstrap' section] of api application config
(or update application config manually with same changes as in `JsonApiBootstrap` class )
see tests/testapp/config/api.php.
-
Create your controller classes by extending `JsonApiController` or `JsonApiActiveController` which contains predefined
CRUD actions.
See examples at tests/testapp/controllers.
['bootstrap' section]: https://www.yiiframework.com/doc/guide/2.0/en/runtime-bootstrapping
### Testing
- Clone project
- Run make up
- Run once make installdocker
- Run make testdocker
or make cli
and inside docker env make test
|
Applications that use this package |
|
No pages of applications that use this class were specified.
If you know an application of this package, send a message to the author to add a link here.