Reputation: 1268
I need to match some different routes to aim the same page.
E.g.: / , /inicio, /home -> must show the landing page
$app->get('/', function () use ($app) {
return $app['twig']->render(
'home.html.twig',
array(
'page' => 'home'
)
);
})
->bind('home');
And I'd like to avoid the same for each route. I'd like to do something like
$app->match('/|/home|/inicio, function() use ($app) {} );
Upvotes: 1
Views: 194
Reputation: 34107
Maybe you're looking for this:
$app->get("/{slug}", function ($slug) use ($app) {
// your regular action logic
})->assert("slug", '^(home|inicio)$');
Here's the link to the docs on route requirements.
Upvotes: 1