PHP code example of teariot / beautyslug

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

    

teariot / beautyslug example snippets


use BeautySlug\BeautySlug;
use BeautySlug\SlugWords;

// Basic random slug
echo BeautySlug::slug(); 
// Example: wonderful-tree

// Slug with a color and an animal
echo BeautySlug::slug([
    SlugWords::color(1),
    SlugWords::animal(1),
]);
// Example: blue-lion

// Slug with digits appended
echo BeautySlug::slug([
    SlugWords::adjective(1),
    SlugWords::noun(1),
], [
    'appendDigits' => true,
    'digitsCount' => 5,
]);
// Example: fancy-robot-48291

SlugWords::adjective(2); // Get 2 random adjectives
SlugWords::noun(1);      // Get 1 random noun
SlugWords::color(1);     // Get 1 random color
bash
php examples/usage.php