1. Go to this page and download the library: Download ausi/slug-generator library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
ausi / slug-generator example snippets
use Ausi\SlugGenerator\SlugGenerator;
$generator = new SlugGenerator;
$generator->generate('Hello Wörld!'); // Output: hello-world
$generator->generate('Καλημέρα'); // Output: kalemera
$generator->generate('фильм'); // Output: film
$generator->generate('富士山'); // Output: fu-shi-shan
$generator->generate('國語'); // Output: guo-yu
// Different valid character set, a specified locale and a delimiter
$generator = new SlugGenerator((new SlugOptions)
->setValidChars('a-zA-Z0-9')
->setLocale('de')
->setDelimiter('_')
);
$generator->generate('Äpfel und Bäume'); // Aepfel_und_Baeume