PHP code example of malenki / fictif

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

    

malenki / fictif example snippets


$bd = new \Malenki\Fictif\Birthday();
$bd->format('d/m/Y'); // if not given, the date will be 'YYYY-MM-DD'
echo $bd->generateOne();
// you can use the object in string context too
echo $bd;

$bd = new \Malenki\Fictif\Birthday();
$bd->minYear(1967);
$bd->maxYear(1980);
echo $bd;

$bd = new \Malenki\Fictif\Birthday();
$bd->minYear(1967);
$bd->maxYear(1980);
$arr = $bd->generateMany(23);
foreach($arr as $k => $v)
{
    printf('Date #%d: %s', $k + 1, $v);
}

$m = \Malenki\Fictif\Email();
$m->allowThisDomain(array('one','other')); // add new available domains
$m->allowThisExt(array('ru', 'jp')); // add some other extensions
//OR, for only one choice:
$m->setDomain('foo'); // will be always [email protected]
$m->setExt('fr'); // will be always [email protected]

$m = new \Malenki\Fictif\Email();
echo $m;

$fn = new \Malenki\Fictif\FirstName();
echo $fn->takeOne();
// or just that in string context:
echo $fn;

$fn = new \Malenki\Fictif\FirstName();
$fn->onlyWomen();
echo $fn->takeOne();

$fn = new \Malenki\Fictif\FirstName();
$fn->onlyMen();
echo $fn->takeOne();

$fn = new \Malenki\Fictif\FirstName();
$fn->onlyBoth();
echo $fn->takeOne();

$fn = new \Malenki\Fictif\FirstName();
$fn->onlyWomen();
$arr = $fn->takeMany(20);
var_dump($arr);
foreach($arr as $k => $v)
{
    printf('Firstname #%d: %s', $k + 1, $v);
}

$l = new \Malenki\Fictif\Login();
echo $l->generateOne()
//or just:
echo $l;

$p = new \Malenki\Fictif\Password();
$p->fixedSize(4);
echo $p->generateOne();
// you can do that too:
echo $p;

$p = new \Malenki\Fictif\Password();
$p->allowThis('-_/^$&');
echo $p;

$p = new \Malenki\Fictif\Password();
$p->onlyLetters();
echo $p;

$p = new \Malenki\Fictif\Password();
$p->onlyDigits();
echo $p

$u = new \Malenki\Fictif\User();
$u->exportOneToJson(); // to have only one user
$u->exportManyToJson(10); // to have ten users
 php
$p = new \Malenki\Fictif\Password();
$p->minimal(5)->maximal(15);
echo $p->generateOne();
 php
$u = new \Malenki\Fictif\User();
$u->password->onlyDigits();
 php
$u = new \Malenki\Fictif\User();
$u->disableLogin();