simple-php-router
simple-php-router copied to clipboard
Simple, fast and yet powerful PHP router that is easy to get integrated and in any project. Heavily inspired by the way Laravel handles routing, with both simplicity and expand-ability in mind.
I have code like that: ```php function input($index = null, $defaultValue = null, ...$methods) { if ($index !== null) { return request()->getInputHandler()->value($index, $defaultValue, ...$methods); } return request()->getInputHandler(); } ``` ```php...
I want to create nested resource routes. But I get route not found error. Can you add this feature like laravel? ``` Router::resource('/tickets', TicketController::class)->name('support.tickets'); Router::resource('/tickets/{ticketID}/messages', TicketMessageController::class)->name('support.tickets.messages'); ``` https://laravel.com/docs/10.x/controllers#restful-nested-resources
# Current behavior Lets take the following example snippet: ```php $route = SimpleRouter::get('/route/with/{parameter}', function() {}); $parameters = $route->getParameters(); // $parameters == [ 'parameter' => null ] $route->setUrl('/route/with/{differentparameter}'); $parameters = $route->getParameters();...
Usage of this inside sub-directory or folder: If you are using this as under a sub-directory or folder then you will have to put your sub-folder name prefix with route,...
Deprecated: Return type of Pecee\Http\Input\InputItem::offsetGet($offset) should either be compatible with ArrayAccess::offsetGet(mixed $offset): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice Fix: Add the #[\ReturnTypeWillChange] attribute...
Hi, I'm using Simple-Router for quite a while and it's been marvelous, **but I'm facing a problem with post requests**, specially on my /api/login/request URL. For some reason it returns...
I'm using the latest version of this package (4.3.7.2) I just tried to create a small middleware to check if a user is authorized to do a certain action. I...
Fatal error: Uncaught Error: Typed property Pecee\SimpleRouter\Router::$request must not be accessed before initialization in /vendor/pecee/simple-router/src/Pecee/SimpleRouter/Router.php:221 Stack trace: #0 /vendor/pecee/simple-router/src/Pecee/SimpleRouter/Router.php(295): Pecee\SimpleRouter\Router->processRoutes() #1 /vendor/pecee/simple-router/src/Pecee/SimpleRouter/Router.php(337): Pecee\SimpleRouter\Router->loadRoutes() #2 /vendor/pecee/simple-router/src/Pecee/SimpleRouter/SimpleRouter.php(69): #6 {main} thrown in /vendor/pecee/simple-router/src/Pecee/SimpleRouter/Router.php...
Please add @return never doc attr for the Response::json() method too, as it was done for Response::redirect(). Thanks.