ausi / slug-generator

Slug Generator Library for PHP, based on Unicode’s CLDR data

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to force slug-generator not to convert a comma?

Dudaevskiy opened this issue · comments

Hello, thanks for your great product.
Now I am writing a plugin for CMS Grav, and I need a comma to not be cropped after processing the line.
For example, there was a line like this:
WordPress, Plugins WordPress
It became like this:
wordpress,plugins-wordpress

How do I get the comma to remain in the link?

Hi, thanks for the great feedback!

You can use the validChars option to achieve this:

$generator = new \Ausi\SlugGenerator\SlugGenerator;
$generator->generate('WordPress, Plugins WordPress', ['validChars' => 'a-z0-9,']);

Thanks