PHP code example of grantholle / laravel-username-generator

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

    

grantholle / laravel-username-generator example snippets


return [
    'adjectives' => 2,
    'nouns' => 1,
    'digits' => 2,
    // The casing leverages Laravel's string helper functions:
    // "lower", "upper", "studly", "kebab", "camel", "snake", "slug"
    'casing' => 'slug',
];

use GrantHolle\UsernameGenerator\Username;

$username = Username::make();
// grave-tame-tiger-60

use GrantHolle\UsernameGenerator\Username;

$username = (new Username)
    ->withAdjectiveCount(2)
    ->withNounCount(2)
    ->withDigitCount(4)
    ->withCasing('snake')
    ->generate();
// gentle_wan_chimpanzee_sandpiper8828
bash
php artisan vendor:publish --tag="laravel-username-generator-config"
bash
php artisan make:username --count 2 --digits 8 --casing studly
# OrdinaryHerring02683641
# WittyGoat89531555