Skip to content

Commit

Permalink
Update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
philipobenito committed May 18, 2020
1 parent b2d3cf6 commit 48002e7
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 1 deletion.
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,18 @@ All notable changes to this project will be documented in this file.

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

## [4.4.0] 2020-05

### Added
- Ability to pass JSON flags to JsonStrategy. (@pine3ree)
- Router is now a RequestHandlerInterface so can be used as a middleware itself. (@delboy1978uk)
- Route params now added as Request attributes. (@delboy1978uk)

### Fixed
- Exception moved to more appropriate place when shifting no middleware. (@delboy1978uk)
- Ensure group prefix is always added when adding a parent group. (@delboy1978uk)


## [4.3.1] 2019-07

### Fixed
Expand Down
14 changes: 14 additions & 0 deletions docs/4.x/strategies.md
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,20 @@ function arrayController(ServerRequestInterface $request, array $args) : array {
});
~~~

### JSON Flags

You can pass an optional second argument to the `JsonStrategy` to define the JSON flags to use when encoding the response.

~~~php
<?php declare(strict_types=1);

$responseFactory = new Http\Factory\Diactoros\ResponseFactory;
$strategy = new League\Route\Strategy\JsonStrategy($responseFactory, JSON_BIGINT_AS_STRING);

$router = (new League\Route\Router)->setStrategy($strategy);
~~~


### Exception Decorators

`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.
Expand Down
2 changes: 1 addition & 1 deletion docs/_data/releases.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
name: League\Route 4.x
type: Current
requires: PHP >= 7.1.0
release: 4.3.1 - 2019-07
release: 4.4.0 - 2020-05
support: Ongoing
url: /4.x/
menu:
Expand Down
1 change: 1 addition & 0 deletions src/Strategy/JsonStrategy.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ class JsonStrategy extends AbstractStrategy implements ContainerAwareInterface
* Construct.
*
* @param ResponseFactoryInterface $responseFactory
* @param int $jsonFlags
*/
public function __construct(ResponseFactoryInterface $responseFactory, int $jsonFlags = 0)
{
Expand Down

0 comments on commit 48002e7

Please sign in to comment.