PHP code example of amirrh6 / simpleslug

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

    

amirrh6 / simpleslug example snippets




leSlug = new SimpleSlug\Engine(words_count: 3, capitalize_the_first_word: true);

for ($x = 0; $x < 5; $x++) {
    if ($x == 1) {
        print_r($simpleSlug->generate(words_count: 4) . "\n");
    } else {
        print_r($simpleSlug->generate() . "\n");
    }
}

/*
// May output something similar to:

Cubic African rabbit
Flat yellow Italian fox
Curious blue lamp
Italian traveling cat
American leather cat
*/