Skip to content

molovo/traffic

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
src
 
 
 
 
 
 

Traffic

A simple router in ~500 lines of PHP.

use Molovo\Traffic\Router;

Router::get('/hello', function() {
    echo 'Hello World!';
});

Installing

composer require "molovo/traffic"

Usage

// GET /news/2
Router::get('/news/{page:int}', function($page) {
    echo $page; // 2
});

// POST /user/hi@molovo.co
Router::get('/user/{email:email}', function($email) {
    echo $email; // hi@molovo.co
});

// Call execute once routes have been defined to
// execute the callback for the matching route.
Router::execute();

About

A simple router in ~200 lines of PHP.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages