PHP code example of breda / slugger

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

    

breda / slugger example snippets


use BReda\Slugger\Slugger;

// Normal call
$slugger = new Slugger('-', [
    // Presets here, remove/add what's needed, 
    // but at least the basic preset should be present.
    new \BReda\Slugger\Presets\BasicPreset,
    new \BReda\Slugger\Presets\ArabicPreset,
]);

// Load a new preset
$slugger->loadPreset(new \BReda\Slugger\Presets\FrenchPreset);

// Make the slug
$slugged = $slugger->make("This should be slugged");

// Statically
// When using staticMake, all available presets will be loaded.
$slugged = Slugger::staticMake("This should be slugged too", "-");