Skip to content

Instantly share code, notes, and snippets.

View mjburgess's full-sized avatar

Michael mjburgess

View GitHub Profile
<?php
/**
* Basic dispatch function, uses array structured as [$verb => [$path => $route_fn, ...]]
* calling $route_fn if $path/$verb match the arguments passed
*
* @param $path_condition regex for matching paths (must use suitable deliminator, eg. @)
*
* @throws Exception when path/route function missing (programmer error)
* @return bool true for successful route, false for no route/404
*/