sowl/laravel-doctrine-jsonapi

Package for the Laravel that allows developers to create JSON:API endpoints using the Doctrine ORM for data persistence.

10.0.1 2024-01-07 19:31 UTC

This package is auto-updated.

Last update: 2024-04-16 20:30:28 UTC


README

Implement feature-rich JSON:API compliant APIs in your Laravel applications using Doctrine ORM.

Features

  • Built for Doctrine ORM
  • Battle-tested
  • Standardised, consistent APIs
  • Fetch resources
  • Fetch relationships
  • Inclusion of related resources (compound documents)
  • Sparse field sets
  • Sorting
  • Pagination
  • Filtering
  • Create resources
  • Update resources
  • Update relationships
  • Delete resources

Documentation

Installation instructions, config guides and tutorials.

Documentation

Development

Clone the project locally.

Install the package dependencies and run the tests:

docker compose run php

To enter the docker container:

docker compose run php sh

Testing

Testing Documentation

Roadmap

  • Make it possible to disable links generation. As it is not required by JSON:API spec and increases response size.
  • Create a validation rule "resource", "resourceExists" for validating resource identifier. Example of usage: php $this->validate($request, [ 'data' => 'required|resource:users', ]);
  • Create default global error handler or write down documentation how to create such one. How to handle missing route\endpoint 404 and internal 500 errors.
  • Create console command for resource policy generation: "jsonapi:make:policy".
  • Checkout option for adding include params like "include=roles:sort" (TransformerAbstract.php:173)