sframe / route
route component
dev-master
2014-12-04 13:51 UTC
Requires
- php: >=5.3.0
This package is not auto-updated.
Last update: 2024-12-31 05:31:23 UTC
README
Simple router. You can specify the route Or if not specified it'll take controller/action as default example: http://hello.com/controller/action?name=test
Installation
composer require "sframe/router:dev-master"
Usage
$route = new SFrame\Router\Route(__DIR__ .'/Controllers'); // groups $route->group(['prefix'=>'v1', 'before'=>function(){ echo 'hello'; }], function($route){ $route->get('test', 'TestController@tt'); $route->post('hello', 'TestController@hello'); }); $route->put('test', 'TestController@pp'); $route->delete('test', 'TestController@dd'); try { $route->dispatch(); } catch (SFrame\Router\Exception\NotFound $e) { redirect('/404.html'); }