Skip to content

Instantly share code, notes, and snippets.

@Ronmi
Created October 19, 2015 10:21
Show Gist options
  • Select an option

  • Save Ronmi/6fb56b74aa0ca598d814 to your computer and use it in GitHub Desktop.

Select an option

Save Ronmi/6fb56b74aa0ca598d814 to your computer and use it in GitHub Desktop.
PoC of router - creating routing table
<?php
require('vendor/autoload.php');
$mux = new Fruit\RouteKit\Mux;
$mux
->get('/', ['\A\B\C', 'methodA'])
->get('/obj/methodA', ['Obj', 'methodA'])
->get('/obj/methodB', ['Obj', 'methodB'])
->get('/initobj/methodC', ['InitObj', 'methodC'], [1, 'abc'])
->get('/cls/methodD', '\Cls::methodD')
->get('/some/funct', 'some_funct')
->get('/user/:id/email', ['User', 'Email'])
->get('/user/:id', ['User', 'Info']);
$ret = $mux->compile(' ');
echo $ret;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment