Skip to content

Commit 743b4e4

Browse files
author
Designcise
committed
Methods in a route configuration array can now be case-insensitive
1 parent e64a6ba commit 743b4e4

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "designcise/bitframe",
3-
"version": "1.0.9",
3+
"version": "1.1.0",
44
"description": "PHP PSR-15 / PSR-7 middleware dispatcher microframework",
55
"type": "library",
66
"keywords": ["Designcise", "BitFrame", "Microframework", "Framework", "Middleware Dispatcher", "PSR-7", "PSR-15"],

src/Delegate/RoutesDelegate.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,10 @@ class RoutesDelegate {
3232
* // etc.
3333
* ];
3434
*
35-
* @param array $routes
35+
* @param array $routes An array of routes that can have 'method', 'path' and 'controller' keys.
3636
*
3737
* Note:
38-
* - Routes without a 'controller' defined are skipped.
38+
* - Routes without a 'controller' defined are skipped/ignored.
3939
* - When 'method' aren't defined, a default 'GET' method is used.
4040
* - When 'path' isn't defined, a default path '/' is used.
4141
*/
@@ -51,6 +51,7 @@ public static function fromConfig(RouteCollectionInterface $routeCollector, arra
5151
// set value, or defaults
5252
$method = $route['method'] ?? 'GET';
5353
settype($method, 'array');
54+
$method = array_map('strtoupper', $method);
5455

5556
$path = '/' . ltrim($route['path'] ?? '', '/');
5657

0 commit comments

Comments
 (0)