<?php /** * This file contains all the routes for the project */ use Pecee\Router; Router::get('/', 'DefaultController@index'); Router::get('/about', 'DefaultController@about'); Router::get('/contact', 'DefaultController@contact'); Router::get('/music/download', 'MusicController@download'); Router::get('/json/search', 'JsonController@search'); Router::get('/language/{lang}', 'DefaultController@language')->where(['lang' => '[a-zA-Z\\-]+']); Router::all('/ajax', 'AjaxController@process')->match('ajax\\/([A-Za-z0-9\\/]+)'); Router::all('/dialog', 'DialogController@process')->match('dialog\\/([A-Za-z0-9\\/]+)'); Router::defaultExceptionHandler('\\mp3vibez\\Handler\\ExceptionHandler');
<?php /** * This file contains all the routes for the project */ use Pecee\Router; Router::group(['middleware' => '\\NinjaImgService\\Middleware\\ApiTokenVerifier'], function () { Router::get('/', 'ControllerDefault@home'); Router::post('/', 'ControllerApi@upload'); Router::put('/', 'ControllerApi@upload'); Router::delete('/', 'ControllerApi@delete'); })->match('.'); Router::defaultExceptionHandler('\\NinjaImgService\\Handler\\CustomExceptionHandler'); Router::csrfVerifier(new \NinjaImgService\Middleware\CsrfVerifier());
// Controlpanel Router::group(['middleware' => 'NinjaImg\\Middleware\\OrganisationValidator'], function () { Router::group(['prefix' => '/service', 'exceptionHandler' => '\\NinjaImg\\Handler\\JsonExceptionHandler'], function () { Router::resource('/statistics', 'Service\\ControllerStatistic'); }); Router::get('/controlpanel', 'ControllerControlpanel@home')->setAlias('controlpanel.home'); Router::get('/controlpanel/sources/clear-cache/{id}', 'ControllerControlpanel@clearcache')->setAlias('controlpanel.source.clearcache'); Router::match(['get', 'post'], '/controlpanel/sources/add/{type?}', 'ControllerControlpanel@sourceAdd')->setAlias('controlpanel.source.add'); Router::match(['get', 'post'], '/controlpanel/sources/edit/{id}/{type}', 'ControllerControlpanel@sourceEdit')->setAlias('controlpanel.source.edit'); Router::get('/controlpanel/sources/delete/{id}', 'ControllerControlpanel@sourceDelete')->setAlias('controlpanel.source.delete'); Router::match(['get', 'post'], '/controlpanel/account', 'ControllerControlpanel@account')->setAlias('controlpanel.account'); Router::get('/controlpanel/sources', 'ControllerControlpanel@source')->setAlias('controlpanel.source'); Router::get('/controlpanel/invoices', 'ControllerControlpanel@invoices')->setAlias('controlpanel.invoices'); Router::get('/controlpanel/statistic', 'ControllerControlpanel@statistic')->setAlias('controlpanel.statistic'); Router::match(['get', 'post'], '/controlpanel/payment', 'ControllerControlpanel@payment')->setAlias('controlpanel.payment'); }); // Administration Router::group(['prefix' => '/admin'], function () { Router::get('/', 'ControllerAdmin@home')->setAlias('admin.home'); Router::get('/payments', 'Admin\\ControllerPayment@usage')->setAlias('admin.payment'); Router::match(['get', 'post'], '/payments/details/{organisationId}', 'Admin\\ControllerPayment@details')->setAlias('admin.payment.details'); Router::get('/payments/history', 'Admin\\ControllerPayment@history')->setAlias('admin.payment.history'); Router::match(['get', 'post'], '/settings', 'ControllerAdmin@settings')->setAlias('admin.settings'); Router::match(['get', 'post'], '/organisation/{organisationId}', 'Admin\\ControllerOrganisation@home')->setAlias('admin.organisation.home'); Router::get('/organisation/{organisationId}/activity', 'Admin\\ControllerOrganisation@activity')->setAlias('admin.organisation.activity'); Router::match(['get', 'post'], '/organisation/{organisationId}/invoices/{invoiceId?}', 'Admin\\ControllerOrganisation@invoices')->setAlias('admin.organisation.invoices'); }); Router::get('/organisations/{id?}', 'ControllerControlpanel@organisations')->setAlias('controlpanel.organisations'); Router::match(['get', 'post'], '/organisations', 'ControllerControlpanel@organisations')->setAlias('controlpanel.organisations'); Router::all('/modal', 'ControllerModal@show')->match('modal\\/([A-Za-z0-9\\/]+)');
<?php require_once '../config/init.php'; use Pecee\Router; Router::start();
<?php require_once '../config/init.php'; $router = \Pecee\Router::GetInstance(); $router->addAlias(new \Xayer\Router\RouterAlias()); // Route request try { $router->routeRequest(); } catch (\Pecee\Router\RouterException $e) { // Show widget here that displays 404 throw $e; } catch (\Exception $e) { throw $e; }