1. Go to this page and download the library: Download johnykvsky/dummyproviders 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/ */
$container = DefinitionContainerBuilder::all(); // initialize the container with core extensions
$en_US_pack = new EnUsDefinitionPack(); // en_US provider definitions pack
foreach ($en_US_pack->all() as $id => $class) { // add all extensions
$container->add($id, $class);
}
$generator = new DummyGenerator($container); // create generator with providers
echo $generator->state(); // i.e. "Arkansas"
echo $generator->realText(); // it will give you part of ./resources/en_US.txt
$container = DefinitionContainerBuilder::all(); // initialize the container with core extensions
$generator = new DummyGenerator($container); // create generator with no providers, core extensions are loaded
echo $generator->state(); // will throw an error, no such method in Address extension
echo $generator->withProvider(new EnUsDefinitionPack())->state(); // en_US provider is loaded, output will be i.e. "Arkansas"
echo $generator->state(); // will throw an error, no such method in Address extension
$container = DefinitionContainerBuilder::all(); // initialize the container with core extensions
$generator = new DummyGenerator($container); // create generator with no providers, core extensions are loaded
$en_US_generator = $generator->withProvider(new EnUsDefinitionPack());
echo $en_US_generator->state(); // i.e. "Arkansas"
echo $en_US_generator->stateAbbr(); // i.e. "CA"
// since $generator stays as it was, there is no such method as state()
$generator->state() // error
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.