Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create signature with route params #10

Merged
merged 1 commit into from
Aug 23, 2015

Conversation

gianarb
Copy link
Contributor

@gianarb gianarb commented Aug 23, 2015

Now signature of method supports route params

$router = \FastRoute\simpleDispatcher(function (\FastRoute\RouteCollector $r) {
    $r->addRoute('GET', '/{id:\d+}', ['TestApp\Controller\Index', 'getSingle']);
});
$this->app = new \GianArb\Penny\App($router);

AppTest\Controller\Index

<?php
namespace TestApp\Controller;
use Zend\Diactoros\Request;
use Zend\Diactoros\Response;

class Index
{
    public function getSingle(Request $request, Response $response, $id)
    {
        $response->getBody()->write("id=$id");
        return $response;
    }
}

gianarb pushed a commit that referenced this pull request Aug 23, 2015
@gianarb gianarb merged commit 2928ff6 into master Aug 23, 2015
@gianarb gianarb deleted the feature/route-params-in-signature branch August 24, 2015 07:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant