Skip to content

Commit 48002e7

Browse files
committed
Update docs
1 parent b2d3cf6 commit 48002e7

File tree

4 files changed

+28
-1
lines changed

4 files changed

+28
-1
lines changed

CHANGELOG.md

+12
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,18 @@ All notable changes to this project will be documented in this file.
44

55
The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/).
66

7+
## [4.4.0] 2020-05
8+
9+
### Added
10+
- Ability to pass JSON flags to JsonStrategy. (@pine3ree)
11+
- Router is now a RequestHandlerInterface so can be used as a middleware itself. (@delboy1978uk)
12+
- Route params now added as Request attributes. (@delboy1978uk)
13+
14+
### Fixed
15+
- Exception moved to more appropriate place when shifting no middleware. (@delboy1978uk)
16+
- Ensure group prefix is always added when adding a parent group. (@delboy1978uk)
17+
18+
719
## [4.3.1] 2019-07
820

921
### Fixed

docs/4.x/strategies.md

+14
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,20 @@ function arrayController(ServerRequestInterface $request, array $args) : array {
146146
});
147147
~~~
148148

149+
### JSON Flags
150+
151+
You can pass an optional second argument to the `JsonStrategy` to define the JSON flags to use when encoding the response.
152+
153+
~~~php
154+
<?php declare(strict_types=1);
155+
156+
$responseFactory = new Http\Factory\Diactoros\ResponseFactory;
157+
$strategy = new League\Route\Strategy\JsonStrategy($responseFactory, JSON_BIGINT_AS_STRING);
158+
159+
$router = (new League\Route\Router)->setStrategy($strategy);
160+
~~~
161+
162+
149163
### Exception Decorators
150164

151165
`League\Route\Strategy\JsonStrategy` will decorate all exceptions, `NotFound`, `MethodNotAllowed`, and any 4xx or 5xx exceptions as a JSON Response, setting the correct HTTP status code and content type header in the process.

docs/_data/releases.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
name: League\Route 4.x
1717
type: Current
1818
requires: PHP >= 7.1.0
19-
release: 4.3.1 - 2019-07
19+
release: 4.4.0 - 2020-05
2020
support: Ongoing
2121
url: /4.x/
2222
menu:

src/Strategy/JsonStrategy.php

+1
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ class JsonStrategy extends AbstractStrategy implements ContainerAwareInterface
3232
* Construct.
3333
*
3434
* @param ResponseFactoryInterface $responseFactory
35+
* @param int $jsonFlags
3536
*/
3637
public function __construct(ResponseFactoryInterface $responseFactory, int $jsonFlags = 0)
3738
{

0 commit comments

Comments
 (0)