In your view scripts or controller actions, often it is necessary to convert strings to perform well in urls. You can use this helper classes to perform these behaviors for you.
For example: The string this is just an example
will be converted to this-is-just-an-example
.
./composer.phar require aubiplus\seo
<?php
return [
'seo' => [
'seperator' => '-',
'chars' => [
'/ä|Ä/' => 'ae',
'/ö|Ö/' => 'oe',
'/ü|Ü/' => 'ue'
]
]
];
The defined seperator is used to replace all whitespaces with the given character.
In the chars section you can define own replacements. As you can see in the sample module config the key is a regular expression which will be replaced by the value.
$urlService = $serviceManager->get(\Aubiplus\Seo\Service\Url::class);
echo $urlService->create("this is just an example");
echo $this->seoUrl("this is just an example");
echo $this->seoUrl("this is just an example");
If you're having trouble with this module feel free and create an issue.