Skip to content

Instantly share code, notes, and snippets.

@juneym
Created March 16, 2017 08:45
Show Gist options
  • Save juneym/1f356f56f5a18a24023a1d2a88e5d54b to your computer and use it in GitHub Desktop.
Save juneym/1f356f56f5a18a24023a1d2a88e5d54b to your computer and use it in GitHub Desktop.
Slim3 | passing request and response to an internal object instance
<?php
use \Psr\Http\Message\ServerRequestInterface as Request;
use \Psr\Http\Message\ResponseInterface as Response;
require '../vendor/autoload.php';
$app = new \Slim\App;
$app->get('/hello/{name}', function (Request $request, Response $response) {
$handleObj = new \My\Namespace\HelloHandler($request, $response);
return $handle->run();
});
$app->run();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment