Skip to content

Commit d260836

Browse files
author
Philipp Marien
committed
Merge branch 'release/3.0.0'
2 parents d6d315d + 2540de9 commit d260836

25 files changed

+951
-2390
lines changed

.sensiolabs.yml

Lines changed: 0 additions & 1 deletion
This file was deleted.

.travis.yml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,9 @@
11
language: php
22

33
php:
4-
- 7.0
5-
- 7.1
64
- 7.2
75

8-
env:
9-
- Json Api Bundle
10-
116
before_script:
12-
- composer self-update
137
- composer install
148

159
script: php vendor/bin/phpunit --coverage-text

CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,15 @@
11
Changelog
22
=========
33

4+
## 3.0.0
5+
* updated dependency `enm/json-api-server` to version `3.0.0`
6+
* removed configuration `pagination.limit`
7+
* removed service `enm.json_api_server.pagination.offset_based`
8+
* removed `JsonApiServerDecorator`
9+
* removed `JsonApiLoader`
10+
* removed `ResourceProviderPass`
11+
* removed http factories
12+
413
## 2.2.0
514
* added configuration `pagination.limit`
615
* added service `enm.json_api_server.pagination.offset_based`

README.md

Lines changed: 14 additions & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
JSON API Server-Bundle
22
======================
33
[![Build Status](https://travis-ci.org/eosnewmedia/JSON-API-Server-Bundle.svg?branch=master)](https://travis-ci.org/eosnewmedia/JSON-API-Server-Bundle)
4-
[![SensioLabsInsight](https://insight.sensiolabs.com/projects/56e6d8ea-6f12-45e6-8c2c-c8a75c8a65c7/mini.png)](https://insight.sensiolabs.com/projects/56e6d8ea-6f12-45e6-8c2c-c8a75c8a65c7)
54

65
The symfony integration for [`enm/json-api-server`](https://eosnewmedia.github.io/JSON-API-Server/).
76

@@ -16,33 +15,28 @@ You should read the docs of [`enm/json-api-server`](https://eosnewmedia.github.i
1615
since this bundle only integrate its functionalities into your symfony project.
1716

1817
1. [Configuration](#configuration)
19-
1. [AppKernel](#appkernel)
18+
1. [Bundles](#bundles)
2019
1. [Config](#config)
2120
1. [Routing](#routing)
2221
1. [Request Handler](#request-handler)
23-
1. [Resource Providers](#resource-providers)
24-
1. [Pagination](#pagination)
2522
1. [Error Handling](#error-handling)
2623

2724
*****
2825
*****
2926

3027
## Configuration
3128

32-
### AppKernel (Symfony <= 3.3)
29+
### Bundles
3330

3431
```php
35-
public function registerBundles()
36-
{
37-
$bundles = [
38-
// ...
39-
new Enm\Bundle\JsonApi\Server\EnmJsonApiServerBundle(),
40-
];
41-
42-
// ...
43-
44-
return $bundles;
45-
}
32+
<?php
33+
// confing/bundles.php
34+
return [
35+
// ...
36+
Enm\Bundle\JsonApi\Server\EnmJsonApiServerBundle::class => ['all' => true],
37+
// ...
38+
];
39+
4640
```
4741

4842
*****
@@ -51,15 +45,11 @@ since this bundle only integrate its functionalities into your symfony project.
5145
All bundle configurations are optional.
5246

5347
```yaml
54-
# app/config/services.yml | config/packages/(dev/|prod/|test/|)enm_json_api.yaml
48+
# config/packages/(dev/|prod/|test/|)enm_json_api.yaml
5549
enm_json_api_server:
5650
debug: false
57-
api_prefix: "/api" # configure this to use a url prefix for your json api routes: e.g. /api/{type}
58-
logger: "logger" # a service implementing the psr-3 log interface to log exceptions and debug messages
59-
psr7_factory: "your_psr7_factory_service" # only required if you do not want to use a different for symfony request/response converting
60-
http_foundation_factory: "your_http_foundation_factory_service" # only required if you do not want to use the default implementation shipped with "symfony/psr-http-message-bridge"
61-
pagination:
62-
limit: 10 # limit have to be an integer bigger than 0; if not set 25 is the default
51+
url_prefix: '' # configure this to use a url prefix for your json api routes: e.g. /api/{type}. only needed if a prefix is defined in your routing
52+
route_name_prefix: 'enm.json_api' # Prefix of the route names in symfony (for exception handling). only needed if a nam prefix is defined in your routing
6353
```
6454
6555
*****
@@ -95,7 +85,6 @@ If you use the predefined routing (without api prefix configuration), the follow
9585
DELETE /{type}/{id}/relationship/{relationship}
9686
9787
*****
98-
*****
9988
10089
## Request Handler
10190
Each request handler can simply be registered via the service container (tag: `json_api_server.request_handler`):
@@ -104,64 +93,10 @@ Each request handler can simply be registered via the service container (tag: `j
10493
AppBundle\RequestHandler\YourRequestHandler:
10594
tags:
10695
- { name: json_api_server.request_handler, type: 'myResources' }
107-
108-
AppBundle\RequestHandler\YourGenericRequestHandler:
109-
tags:
110-
- { name: json_api_server.request_handler }
111-
```
112-
113-
The tag attribute `type` must contain the json api resource type which will be handled by this request handler or can
114-
be empty to direct all requests to this handler.
115-
116-
If all requests are handled by your request handler it should be throw a UnsupportedTypeException for unsupported
117-
resource types. If a UnsupportedTypeException is thrown the bundle tries the next registered request handler.
118-
119-
Request handlers with configured type and resource providers are always called before your generic handlers are called.
120-
If a request handler or resource provider matches a request the generic handlers are not called anymore.
121-
122-
Request handlers with configured type are always called before resource providers.
123-
If a request handler matches a request resource providers are not called anymore.
124-
125-
## Resource Providers
126-
Each resource provider can simply be registered via the service container (tag: `json_api_server.resource_provider`):
127-
128-
```yml
129-
app.resource_provider.your_provider:
130-
class: AppBundle\ResourceProvider\YourResourceProvider
131-
tags:
132-
- { name: json_api_server.resource_provider, type: 'myResources' }
133-
```
134-
135-
The tag attribute `type` must contain the json api resource type which will be handled by this provider.
136-
137-
*****
138-
*****
139-
140-
## Pagination
141-
142-
If you want to use offset based pagination (links) in your project, your Request Handler can use the
143-
`Enm\JsonApi\Server\Pagination\PaginationTrait` and can be configured over the service container to use offset based pagination:
144-
145-
```yml
146-
# services.yml:
147-
AppBundle\RequestHandler\YourRequestHandler:
148-
tags:
149-
- { name: json_api_server.request_handler, type: 'myResources' }
150-
calls:
151-
- ['setPaginationLinkGenerator', ['@enm.json_api_server.pagination.offset_based']]
15296
```
15397

154-
The service for offset based pagination links is: `enm.json_api_server.pagination.offset_based`
155-
156-
By default the limit for pagination is 25, but you can overwrite this in your global config:
98+
The tag attribute `type` must contain the json api resource type which will be handled by this request handler.
15799

158-
```yaml
159-
enm_json_api_server:
160-
pagination:
161-
limit: 10 # limit have to be an integer bigger than 0
162-
```
163-
164-
*****
165100
*****
166101

167102
## Error Handling

composer.json

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,13 @@
1313
}
1414
},
1515
"require": {
16-
"php": ">=7.0",
17-
"symfony/framework-bundle": "^2.7|^3.0|^4.0",
18-
"enm/json-api-server": "^2.2",
19-
"symfony/psr-http-message-bridge": "^1.0",
16+
"php": ">=7.2",
17+
"symfony/framework-bundle": "^4.0",
18+
"enm/json-api-server": "^3.0",
2019
"guzzlehttp/psr7": "^1.0"
2120
},
2221
"require-dev": {
23-
"phpunit/phpunit": "^6.1"
22+
"phpunit/phpunit": "^7.0"
2423
},
2524
"license": "MIT",
2625
"authors": [
@@ -29,10 +28,5 @@
2928
"email": "marien@eosnewmedia.de"
3029
}
3130
],
32-
"config": {
33-
"platform": {
34-
"php": "7.0"
35-
}
36-
},
3731
"minimum-stability": "stable"
3832
}

0 commit comments

Comments
 (0)