hello

5 months ago

mechelon

hellooo

Code

am// funny random string

use MatteoGgl\Linnaeus\LinnaeusOptions;

$linnaeus = LinnaeusOptions::create();

$lists = $linnaeus->getLists();

$slug = '';

foreach ($linnaeus->structure as $slug_part) {
  switch ($slug_part) {
    case 'animal':
      $animal = array_rand($lists['animals']);
      $slug .= trans("linnaeus::animals.$animal");
      break;
    case 'adjective':
      $adjective = array_rand($lists['adjectives']);
      $slug .= trans("linnaeus::adjectives.$adjective");
      break;
    case 'color':
      $color = array_rand($lists['colors']);
      $slug .= trans("linnaeus::adjectives.$color");
      break;
  }
  $slug .= ' ';
}

return Str::slug($slug);

Output

=> 1
Video course: PHP Package Development