Skip to content

Instantly share code, notes, and snippets.

@faabiosr
Created May 29, 2012 17:09
Show Gist options
  • Save faabiosr/2829564 to your computer and use it in GitHub Desktop.
Save faabiosr/2829564 to your computer and use it in GitHub Desktop.
Respect\Rest - Tests
{
"require": {
"Respect/Rest": "0.4.6",
"Respect/Data": "dev-master",
"Respect/Config": "0.3.1",
"Respect/Relational": "*",
"Respect/Validation": "0.4.4"
}
}
<?php
require '../vendor/autoload.php';
use Respect\Rest\Router;
$r = new Router();
$r->get('/','HOME');
$r->get('/users',function(){
echo 'users';
});
$r->get('/users/*',function($userId){
echo 'user-'.$userId;
})->when(function($userId){
return is_numeric($userId) && $userId > 0;
});
$r->get('/docs','DOCS!');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment