Last active
December 18, 2015 23:39
-
-
Save wellfreire/5863249 to your computer and use it in GitHub Desktop.
Reproduz teste local com Respect/Rest
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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