darktec/router

Routing package for PHP 7

1.0.6 2020-02-13 00:25 UTC

This package is auto-updated.

Last update: 2024-04-13 09:23:11 UTC


README

Latest Version on Packagist Software License Build Status Total Downloads

This is where your description should go. Try and limit it to a paragraph or two, and maybe throw in a mention of what PSRs you support to avoid any confusion with users and contributors.

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.