Download the PHP package bornfight/jsonapi-bundle without Composer
On this page you can find all versions of the php package bornfight/jsonapi-bundle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package jsonapi-bundle
JsonApiBundle For Symfony
JsonApiBundle is a Symfony bundle. It is the fastest way to generate API based on JsonApi using woohoolabs/yin Library.
Installing
-
Install symfony
-
Install the maker bundle
-
Install the bundle
- Add below line to
config/bundles.php
Usage
-
Use below command to generate entities one by one:
for example, Book and Author entity is as follows:
-
Generate CRUD API:
- You can find the generated "collections" for postman and swagger in the following path and then test the API:
Features
Pagination
Sorting
- Ascending on name field:
http://example.com/books?sort=name
- Decending on name field:
http://example.com/books?sort=-name
- Multiple fields:
http://example.com/books?sort=city,-name
- Field on a relation:
http://example.com/books?sort=author.name
Relationships
multiple relationships
Search
As the JSON API specification does not specify exactly how filtering should work different methods of filtering can be used. Each method is supplied with a Finder service. Each registered Finder will be able to append conditions to the search query. If you register multiple Finders they are all active at the same time. This enables your API to support multiple filtering methods.
Basic Finder.
A basic Finder is included in this library offering simple filtering capabilities:
This request will return all the books that author's name begin with hamid
Below line has additional condition: books which have "php" in their title.
Other Finders
Currently the following Finders are available via other bundles:
-
mnugter/jsonapi-rql-finder-bundle - RQL based Finder
- paknahad-jsonapi-querifier-bundle - Querifier based Finder
Creating a custom Finder
A Finder can be registered via a service tag in the services definition. The tag paknahad.json_api.finder
must be
added to the service for the Finder to be resigered.
Example:
Each Finder must implement the Paknahad\JsonApiBundle\Helper\Filter\FinderInterface
interface.
Validation
Error on validating associations
Validate attributes if you have defined validators on entities.
Error handler
All errors such as:
- Internal server error (500)
- Not found (404)
- Access denied (403)
has responses like this:
NOTICE: the "meta" field gets filled just on development environment.
All versions of jsonapi-bundle with dependencies
ext-json Version *
sensio/framework-extra-bundle Version ^5.2
symfony/psr-http-message-bridge Version ^1.0
symfony/proxy-manager-bridge Version ^4.1
symfony/orm-pack Version ^1.0
symfony/validator Version ^4.1
woohoolabs/yin Version ^3.0
nyholm/psr7 Version ^1.1