Skip to content

Commit 5dc073f

Browse files
committed
Merge pull request #223 from Rican7/feature/changelog-and-upgrading-doc
Feature - Changelog and Upgrading doc
2 parents f9fc039 + cb99d02 commit 5dc073f

File tree

3 files changed

+78
-3
lines changed

3 files changed

+78
-3
lines changed

CHANGELOG.md

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# CHANGELOG
2+
3+
## 2.1.0
4+
5+
### Features
6+
7+
- New exception and helper methods to help control the dispatch flow
8+
- New `abort()` method to allow stopping the routing process and returning a response code
9+
- Routes are now instances of a new `Route` class, instead of just being a set of meta properties and a callback
10+
- Routes are now stored in a `RouteCollection` class, which extends the `DataCollection` class
11+
- New `keys()` and `clear()` methods for the `DataCollection` class
12+
- Added the capability of reverse routing!
13+
- Now allowing for route callbacks to change the response object by returning a new ApiResponse instance
14+
- New "slug" type for route param matching
15+
- New `isEmpty()` and `cloneEmpty()` methods for the `DataCollection` class
16+
- The `$matched` route callback parameter is now an instance of a `RouteCollection`, instead of just an integer
17+
- Route callbacks are now passed the Klein instance for easier closure/class-scope use
18+
- Regular expression routing is now more accurate and will match more special characters in a similar way to Sinatra
19+
- Routes are now built with a dependency injected `AbstractRouteFactory` instance, allowing the building of routes to be customized more easily
20+
- New `options()` and `head()` alias methods for matching OPTIONS and HEAD requests respectively
21+
- The `Response` class has been abstracted into an `AbstractResponse` and a separate `Response` class for cleaner 3rd-party extension
22+
- New "after dispatch" callbacks can be registered for firing a series of callbacks after the dispatch loop has completed
23+
- New `patch()` alias method for matching PATCH requests
24+
- New HTTP error handling via exceptions and callback registration for a more direct (and less magical) API for controlling HTTP errors
25+
- The `escape()` method in the `ServiceProvider` class now allows for the passing of entity escaping flags
26+
- Route regular expressions are now validated and provide helpful errors upon a validation failure
27+
- Routes can now contain an empty string path
28+
- The composer autoloader is now compatible with the PSR-4 standard.
29+
- Regular expression compilation performance has been improved
30+
- 100% Code Coverage
31+
32+
### Bug fixes
33+
34+
- The README document has been updated to fix a few typos and inconsistencies
35+
- Route params are now properly URL decoded
36+
- 404/405 routes now properly set the appropriate status code automatically
37+
- Silencing the locked response exceptions as the behavior is designed to be transparent/automatic
38+
- Allow route callables to be an array suitable for `call_user_func()` callable behavior
39+
- More proper handling for 404's that also call the 404 error handlers
40+
- The `file()` and `json()` methods in the `Response` class no longer override system-configured time processing limits
41+
- Now checking if the output buffer is open before attempting to close it
42+
- The methods matched counter (`$methods_matched`) is now much more accurate, not counting methods that shouldn't have been considered matches
43+
- Various PHPdoc inaccuracies and inconsistencies have been fixed
44+
- Regular expressions are now quoted during compilation in a much safer manner
45+
- The PHPdoc tags have been updated to use the more modern syntax

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
[![Build Status](https://travis-ci.org/chriso/klein.php.png?branch=master)](https://travis-ci.org/chriso/klein.php)
44

5-
**klein.php** is a lightning fast router for PHP 5.3+
5+
**klein.php** is a fast & flexible router for PHP 5.3+
66

77
* Flexible regular expression routing (inspired by [Sinatra](http://www.sinatrarb.com/))
88
* A set of [boilerplate methods](#api) for rapidly building web apps
@@ -18,8 +18,8 @@
1818
## Composer Installation
1919

2020
1. Get [Composer](http://getcomposer.org/)
21-
2. Require Klein with `php composer.phar require klein/klein v2.0.x`
22-
3. Install dependencies with `php composer.phar install`
21+
2. Require Klein with `php composer.phar require klein/klein`
22+
3. Add the following to your application's main PHP file: `require 'vendor/autoload.php';`
2323

2424
## Example
2525

UPGRADING.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# Klein Upgrade Guide
2+
3+
## 2.0.x to 2.1.0
4+
5+
### Deprecations
6+
7+
- Handling 404 and 405 errors with a specially registered route callback is now deprecated. It's now suggested to use Klein's new `onHttpError()` method instead.
8+
- Autoloading the library with Composer no longer utilizes the PSR-0 spec. The composer autoloader now uses PSR-4.
9+
10+
### Interface Changes
11+
12+
- Some of the route callback params have changed. This will effect any route definitions with callbacks using the more advanced parameters.
13+
- The old params were (in order):
14+
- `Request $request`
15+
- `Response $response`
16+
- `Service $service`
17+
- `App $app`
18+
- `int $matched`
19+
- `array $methods_matched`
20+
- The new params are (in order):
21+
- `Request $request`
22+
- `Response $response`
23+
- `Service $service`
24+
- `App $app`
25+
- `Klein $klein`
26+
- `RouteCollection $matched`
27+
- `array $methods_matched`
28+
- Non-match routes (routes that are wildcard and shouldn't consider as "matches") will no longer be considered as part of the "methods matched" array, since they aren't supposed to be matches in the first place
29+
- This may have implications for users that have created "match-all" OPTIONS method routes, as the OPTIONS method will no longer be considered a match.
30+
- If you'd like to conserve the old match behavior, you can simply mark the route as one that should be counted as a match with `$route->setCountMatch(true)`

0 commit comments

Comments
 (0)