Hi, i'm trayng to replace part of my url routing, removing spaces ' ' by '-' but i can't.
Ex: A app called: "my app name" with my code displays:
online/10/my%20app%20name
But want to show:
online/10/my-app-name
In my services.php i put
$di->set('router', function() {
$router = new Router();
$router->removeExtraSlashes(true);
$router->add(
'/online/{id}/{name}',
array(
'controller' => 'application',
'action' => 'app',
'id' => 1,
'name' => 2,
))->convert('name', function($name){
return str_replace(' ', '-', $name);
});
return $router
});
According my understanding about Routing documentation ->convert should be able to do what do i need.