Vendor lock
This commit is contained in:
31
vendor/zeuxisoo/slim-whoops/examples/index.php
vendored
Normal file
31
vendor/zeuxisoo/slim-whoops/examples/index.php
vendored
Normal file
@ -0,0 +1,31 @@
|
||||
<?php
|
||||
require dirname(__DIR__).'/vendor/autoload.php';
|
||||
|
||||
use Psr\Http\Message\ResponseInterface as Response;
|
||||
use Psr\Http\Message\ServerRequestInterface as Request;
|
||||
use Slim\Factory\AppFactory;
|
||||
|
||||
use Zeuxisoo\Whoops\Slim\WhoopsMiddleware;
|
||||
|
||||
// Instance
|
||||
$app = AppFactory::create();
|
||||
|
||||
// Middleware
|
||||
$app->add(new WhoopsMiddleware());
|
||||
|
||||
// Route parser
|
||||
$routeParser = $app->getRouteCollector()->getRouteParser();
|
||||
|
||||
// Routes
|
||||
$app->get('/', function (Request $request, Response $response, $args) use ($routeParser) {
|
||||
$response->getBody()->write(file_get_contents('template/index.php'));
|
||||
|
||||
return $response;
|
||||
});
|
||||
|
||||
$app->get('/url-path-not-exists', function(Request $request, Response $response, $args) use ($routeParser) {
|
||||
return $routeParser->urlFor('hello');
|
||||
});
|
||||
|
||||
// Run
|
||||
$app->run();
|
Reference in New Issue
Block a user