Skip to content

Commit

Permalink
ServerRequestInterface...
Browse files Browse the repository at this point in the history
  • Loading branch information
Jupiter committed Sep 25, 2018
1 parent 217b2cc commit b26a8a2
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
14 changes: 7 additions & 7 deletions config/routes/app.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,18 @@
use \Psr\Http\Message\ServerRequestInterface as Request;
use \Psr\Http\Message\ResponseInterface as Response;

$app->get('/hello/{name}', function(Request $request, Response $response, $args) {
$name = $request->getAttribute('name');
$response->getBody()->write("Hello, $name");

return $response;
});

// example route to resolve request to uri '/' to \\App\\Http\\Site\\Welcome::index
$app->any('/', function(Request $request, Response $response, $args) use($app) {
return $app->resolveRoute('\App\Http\Site', 'Welcome', 'index', $args);
});

$app->get('/hello/{name}', function(Request $request, Response $response, $args) {
$name = $request->getAttribute('name');
$response->getBody()->write("Hello, $name");

return $response;
});

// example route to resolve request to that matches '/{class}/{method}'
// resolveRoute will try to find a corresponding class::method in a given namespace
$app->any('/{class}/{method}', function(Request $request, Response $response, $args) use($app) {
Expand Down
2 changes: 1 addition & 1 deletion lib/Framework/App.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php

namespace Lib\Framework;
use Psr\Http\Message\RequestInterface;
use Psr\Http\Message\ServerRequestInterface as RequestInterface;
use Psr\Http\Message\ResponseInterface;
use App\Handlers\Error;
use App\Handlers\PhpError;
Expand Down

0 comments on commit b26a8a2

Please sign in to comment.