Skip to content
/ seo Public

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.

License

Notifications You must be signed in to change notification settings

aubiplus/seo

Repository files navigation

Seo

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.

Installation

./composer.phar require aubiplus\seo

Usage

Sample module config:

<?php
return [
    'seo'             => [
        'seperator' => '-',
        'chars'     => [
            '/ä|Ä/' => 'ae',
            '/ö|Ö/' => 'oe',
            '/ü|Ü/' => 'ue'
        ]
    ]
];

Seperator

The defined seperator is used to replace all whitespaces with the given character.

Chars

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.

Use service

$urlService = $serviceManager->get(\Aubiplus\Seo\Service\Url::class);
echo $urlService->create("this is just an example");

Use view helper

echo $this->seoUrl("this is just an example");

Use controller plugin

echo $this->seoUrl("this is just an example");

Questions / support

If you're having trouble with this module feel free and create an issue.

About

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.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages