PHP code example of marvin255 / random-string-generator
1. Go to this page and download the library: Download marvin255/random-string-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/ */
marvin255 / random-string-generator example snippets
use Marvin255\RandomStringGenerator\Generator\RandomStringGenerator;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
class SiteController extends AbstractController
{
public function __construct(private readonly RandomStringGenerator $randomStringGenerator)
{
}
}
$this->randomStringGenerator->alphanumeric(10); // 10 symbols of latin alphabet or digits
$this->randomStringGenerator->alpha(10); // 10 symbols of latin alphabet
$this->randomStringGenerator->numeric(10); // 10 symbols of digits
$this->randomStringGenerator->password(10); // 10 symbols that can be used as password
$this->randomStringGenerator->string(10, 'qwe'); // 10 symbols of provided vocabulary