I couldn't find it anywhere. So I ask: On silex, why do we use bind() for? For example, on this routing of static pages:
$pages = array(
'/' => 'index',
'/blog' => 'blog',
'/about' => 'about',
);
foreach($pages as $route => $view) {
$api->get($route, function(Silex\Application $app) use($view) {
return $app['twig']->render($view.'.html');
})->bind($view);
}
For an event-heavy framework, it's a bit of a poor choice, but this basically names the route.
Things like providers can get access to the routes if they are given a name.
Relevant documentation:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With