Skip to content

Commit

Permalink
Merge branch 'feature/psr-17'
Browse files Browse the repository at this point in the history
Close #4
  • Loading branch information
weierophinney committed May 30, 2017
2 parents 3ea16b5 + e314839 commit 4f2375d
Show file tree
Hide file tree
Showing 28 changed files with 1,895 additions and 1,731 deletions.
11 changes: 0 additions & 11 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,6 @@ matrix:
- php: 7.1
env:
- DEPS=latest
- php: hhvm
env:
- DEPS=lowest
- php: hhvm
env:
- DEPS=locked
- php: hhvm
env:
- DEPS=latest
allow_failures:
- php: hhvm

before_install:
- if [[ $TEST_COVERAGE != 'true' ]]; then phpenv config-rm xdebug.ini || return 0 ; fi
Expand Down
58 changes: 58 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,64 @@

All notable changes to this project will be documented in this file, in reverse chronological order by release.

## 0.2.0 - 2017-05-30

### Added

- [#4](https://github.com/weierophinney/problem-details/pull/4) adds
`ProblemDetailsReponseFactoryFactory` for generating a
`ProblemDetailsResponseFactory` instance.

### Changed

- [#4](https://github.com/weierophinney/problem-details/pull/4) changes the
`ProblemDetailsResponseFactory` in several ways:
- It is now instantiable. The constructor accepts a boolean indicating debug
status (`false` by default), an integer bitmask of JSON encoding flags, a
PSR-7 `ResponseInterface` instance, and a callable factory for generating a
writable PSR-7 `StreamInterface` for the final problem details response
content.
- `createResponse()` is now an instance method, and its first argument is no
longer an `Accept` header, but a PSR-7 `ServerRequestInterface` instance.
- `createResponseFromThrowable()` is now an instance method, and its first
argument is no longer an `Accept` header, but a PSR-7
`ServerRequestInterface` instance.

- [#4](https://github.com/weierophinney/problem-details/pull/4) changes the
`ProblemDetailsMiddleware`; it now composes a `ProblemDetailsResponseFactory`
insteead of an `isDebug` flag. Additionally, it no longer wraps processing of
the delegate in a try/catch block if the request cannot accept JSON or XML.

- [#4](https://github.com/weierophinney/problem-details/pull/4) changes the
`ProblemDetailsMiddlewareFactory` to inject the `ProblemDetailsMiddleware`
with a `ProblemDetailsResponseFactory` instead of an `isDebug` flag.

### Deprecated

- Nothing.

### Removed

- [#4](https://github.com/weierophinney/problem-details/pull/4) removes the
`ProblemDetailsJsonResponse`; use the `ProblemDetailsResponseFactory` instead.

- [#4](https://github.com/weierophinney/problem-details/pull/4) removes the
`ProblemDetailsXmlResponse`; use the `ProblemDetailsResponseFactory` instead.

- [#4](https://github.com/weierophinney/problem-details/pull/4) removes the
`CommonProblemDetails` trait; the logic is now incorporated in the
`ProblemDetailsResponseFactory`.

- [#4](https://github.com/weierophinney/problem-details/pull/4) removes the
`ProblemDetailsResponse` interface; PSR-7 response prototypes are now used
instead.

### Fixed

- [#4](https://github.com/weierophinney/problem-details/pull/4) updates JSON
response generation to allow specifying your own JSON encoding flags. By
default, it now does pretty JSON, with unescaped slashes and unicode.

## 0.1.0 - 2017-05-03

Initial Release.
Expand Down
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@
[![Build Status](https://secure.travis-ci.org/weierophinney/problem-details.svg?branch=master)](https://secure.travis-ci.org/weierophinney/problem-details)
[![Coverage Status](https://coveralls.io/repos/github/weierophinney/problem-details/badge.svg?branch=master)](https://coveralls.io/github/weierophinney/problem-details?branch=master)

This library provides custom response types, error handling middleware, and
exception types for [PSR-7](http://www.php-fig.org/psr/psr-7/) applications.
This library provides provides a factory for generating Problem Details
responses, error handling middleware for automatically generating Problem
Details responses from errors and exceptions, and custom exception types for
[PSR-7](http://www.php-fig.org/psr/psr-7/) applications.

## Installation

Expand Down
20 changes: 13 additions & 7 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,22 @@
"description": "Problem Details for PSR-7 HTTP APIs",
"type": "library",
"license": "BSD-3-Clause",
"config": {
"sort-packages": true
},
"require": {
"php": "^7.1",
"fig/http-message-util": "^1.1.2",
"http-interop/http-middleware": "^0.4.1",
"php": "^7.1",
"psr/container": "^1.0",
"psr/http-message": "^1.0",
"spatie/array-to-xml": "^2.3",
"willdurand/negotiation": "^2.3",
"zendframework/zend-diactoros": "^1.4"
"willdurand/negotiation": "^2.3"
},
"require-dev": {
"phpunit/phpunit": "^6.0",
"zendframework/zend-coding-standard": "^1.0"
"zendframework/zend-coding-standard": "^1.0",
"zendframework/zend-diactoros": "^1.4"
},
"autoload": {
"psr-4": {
Expand All @@ -26,6 +30,11 @@
"ProblemDetailsTest\\": "test/"
}
},
"extra": {
"zf": {
"config-provider": "ProblemDetails\\ConfigProvider"
}
},
"scripts": {
"check": [
"@cs-check",
Expand All @@ -36,8 +45,5 @@
"test": "phpunit --colors=always",
"test-coverage": "phpunit --colors=always --coverage-clover clover.xml",
"upload-coverage": "coveralls -v"
},
"config": {
"sort-packages": true
}
}
Loading

0 comments on commit 4f2375d

Please sign in to comment.