Skip to content

dark-php/router

Repository files navigation

PHP7 Routing Package

Latest Version on Packagist Software License Total Downloads

Install

To install router as a Composer package run:

$ composer require darktec/router

Usage

First initialize the router

Router::init();

Then create your mappings using METHOD, ROUTE, ACTION where ACTION is a function

Router::map('GET', '/', '\package\controller@function');

// OR

Router::map('GET', '/', function() {
    echo 1;
});

Finally match the request method and URI

Router::match($method, $uri);

If a match is found then the function defined is invoked.

Change log

Please see CHANGELOG for more information what has changed recently.

Contributing

Please see CONTRIBUTING and CONDUCT for details.

Credits

License

The MIT License (MIT). Please see License File for more information.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages