Skip to content

Instantly share code, notes, and snippets.

@javiereguiluz
Last active April 20, 2016 09:37
Show Gist options
  • Save javiereguiluz/aa61f8695c881fb70f68 to your computer and use it in GitHub Desktop.
Save javiereguiluz/aa61f8695c881fb70f68 to your computer and use it in GitHub Desktop.
<?php
// app/config/routing.php
use Symfony\Component\Routing\RouteCollection;
use Symfony\Component\Routing\Route;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
$collection = new RouteCollection();
$collection->add('closure_controller', new Route('/closure', [
'_controller' => function (Request $request) {
return new Response('A Closure Controller');
},
]));
return $collection;
// app/config/routing.yml
# ...
_closure:
resource: routing.php
@raulfraile
Copy link

The compiled url matcher contains this:

if ($pathinfo === '/closure') {
    return array (  '_controller' =>   Closure::__set_state(array(  )),  '_route' => 'closure_controller',);
}

@1ed
Copy link

1ed commented Apr 20, 2016

Hi guys! Is there a solution to this problem?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment