Skip to content

Instantly share code, notes, and snippets.

@silentworks
Forked from alanpich/slim1.php
Created November 2, 2012 17:17
Show Gist options
  • Save silentworks/4002858 to your computer and use it in GitHub Desktop.
Save silentworks/4002858 to your computer and use it in GitHub Desktop.
SlimPHP optional path params
/*@var $controllers Array of String */
/**
* Set up Slim listeners for each controller
*/
foreach($controllers as $C){
// Map GET
$slim->get("/$C/:id(/:relation)",function($id,$relation=null){
print_r(array(
'id' => $id,
'relation' => $relation
));
});
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment