Skip to content

Instantly share code, notes, and snippets.

@wellfreire
Last active December 18, 2015 23:39
Show Gist options
  • Save wellfreire/5863249 to your computer and use it in GitHub Desktop.
Save wellfreire/5863249 to your computer and use it in GitHub Desktop.
Reproduz teste local com Respect/Rest
<?php
use Respect\Rest\Routable;
use Respect\Rest\Router;
require_once __DIR__.'/../vendor/autoload.php';
ini_set('display_errors', 1);
error_reporting(-1);
// Test Class
class Teste implements Routable {
function get()
{
return "Teste ok!";
}
}
// Routes
$router = new Router('/public');
$router->any('/', 'Teste');
$router->exceptionRoute('RuntimeException', function($e) {
return 'Caught a Gotcha!';
});
$router->errorRoute(function (array $err) {
return 'Sorry, this errors happened: '.var_dump($err);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment