PHP code example of pragmarx / random

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

    

pragmarx / random example snippets

 php
$this->random = new PragmaRX\Random\Random();

$this->random->get(); /// will generate an alpha string which is the same of

$this->random->alpha()->get();
 php
$this->random->size(32)->get();
 php
$this->random->uppercase()->get();
$this->random->lowercase()->size(255)->get();
 php
$this->random->mixedcase()->get();
 php
$this->random->pattern('[abcd]')->get();

$this->random->pattern('[A-F0-9]')->get(); /// Hexadecimal
 php
$this->random->numeric()->start(10)->end(20)->get();
 php
$this->random->numeric()->size(3)->get();
 php
$this->random->hex()->size(10)->get();
 php
$this->random->hex()->lowercase()->get();
 php
$this->random->hex()->prefix('#')->size(6)->lowercase()->get();
 php
$this->random->prefix('!')->suffix('@')->get();
 php
$this->random->trivia()->get();

$this->random->trivia()->count(2)->get();
 php
$this->random->city()->get();
 php
$this->random->prefix('city: ')->city()->lowercase()->get();
 php
$this->random->fakerClass(AnotherFaker\Factory::class)->date()->get();
 php
$this->random->raw()->get();