mirror of
https://github.com/skipperbent/simple-php-router.git
synced 2026-06-15 18:23:26 +03:00
- Fixed updatae causing middlewares to sometimes load on wrong routes. - Converted project to PSR/2. - Updated InputCollection class and added get method for easy access to values. - Complete refactor of RouterBase. - Added findRoute method to RouterBase. - It's now possible to change parameter modifiers and symbol by overwriting properties on RouterBase. - Added RouterUrlTest unit-test for testing route-urls. - Added IRestController that can be easily implemented in custom ResourceController-classes. - It's now possible to use "-" instead of "_" when using getHeader method in Request class. - Added PHPDocs. - Fixed "/" route sometimes returning "//" as url. - Optimisations and bugfixes.
23 lines
789 B
PHP
23 lines
789 B
PHP
<?php
|
|
/**
|
|
* This file contains all the routes for the project
|
|
*/
|
|
|
|
use Demo\Router;
|
|
|
|
Router::csrfVerifier(new \Demo\Middlewares\CsrfVerifier());
|
|
|
|
Router::group(['exceptionHandler' => 'Demo\Handlers\CustomExceptionHandler'], function () {
|
|
|
|
Router::get('/', 'DefaultController@index')->setAlias('home');
|
|
Router::get('/contact', 'DefaultController@contact')->setAlias('contact');
|
|
Router::get('/404', 'DefaultController@notFound')->setAlias('404');
|
|
Router::basic('/companies', 'DefaultController@companies')->setAlias('companies');
|
|
Router::basic('/companies/{id}', 'DefaultController@companies')->setAlias('companies');
|
|
|
|
// Api
|
|
Router::group(['prefix' => '/api', 'middleware' => 'Demo\Middlewares\ApiVerification'], function () {
|
|
Router::resource('/demo', 'ApiController');
|
|
});
|
|
|
|
}); |