PHP code example of jaenmedina / slugifier

1. Go to this page and download the library: Download jaenmedina/slugifier 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/ */

    

jaenmedina / slugifier example snippets

sh
$slugifier = new Slugifier();
$slug = $slugifier->slugify("Hello, world!");
echo $slug; // prints "hello-world"
sh
$slugifier = new Slugifier();
$slugifier->setSeparator("_");
$slug = $slugifier->slugify("Hello, world!");
echo $slug; // prints "hello_world"
sh
$slugifier = new Slugifier();
$slugifier->excludeWords(["world", "How", "is"]);
$slug = $slugifier->slugify("Hello, world! How is everybody?");
echo $slug; // prints "hello-everybody"
sh
$slugifier = new Slugifier();
$slugifier->setRules(["é" => "e"]);
$slugifier->addRule("ñ", "n");
$slugifier->addRules(["ü" => "u"]);
$slug = $slugifier->slugify("Intenté Español Pingüino");
echo $slug; // prints "intente-espanol-pinguino"