Skip to content

newclass-pl/via

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

README

license PHP 5.4+

What is Via?

Via is a PHP router. Support for http request, cli and a lot more. Create own rule is very simple by implements interfaces.

Via can be used to develop all kind of websites and scripts.

Installation

The best way to install is to use the composer by command:

composer require newclass/via

composer install

Use example

use Via\Action\HTTPAction;
use Via\Action\HTTPRequest;
use Via\Router;

$router=new Router();

$router->addAction(new HTTPAction('/users','get'),new YourDispatcher('users')); //YourDispatcher create by implements Via\Dispatcher interface
$router->addAction(new HTTPAction('/users/{id}.json','post'),new YourDispatcher());

try{    
    $dispatcher=$router->createDispatcher(new HTTPRequest('/users/1232.json','post'));
    $dispatcher->execute();
} catch(RouteNotFoundException $e){
    header("HTTP/1.0 404 Not Found");
}

About

Via is a PHP router.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors