PHP code example of celestriode / dynamic-registry
1. Go to this page and download the library: Download celestriode/dynamic-registry 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/ */
celestriode / dynamic-registry example snippets
class ItemsRegistry extends AbstractRegistry
{
public function getName() : string
{
return 'items';
}
}
class EntitiesRegistry extends AbstractRegistry
{
protected $defaultValues = [1, 2, 3]; // Optional.
public function getName() : string
{
return 'entities';
}
}
class ItemsRegistry extends AbstractStringRegistry
{
public function getName() : string
{
return 'items';
}
}
$registry = new SimpleRegistry(-1, -2, -3); // Optionally add values upon instantiation.
$itemsRegistry = ItemsRegistry::get();
$entitiesRegistry = EntitiesRegistry::get(4, 5, 6); // Optionally add values upon FIRST get() call.
class ItemsPopulator implements DynamicPopulatorInterface
{
public function populate(AbstractRegistry $registry) : void
{
$registry->addValues('a', 'b', 'c');
}
}
class ItemsRegistry extends AbstractStringRegistry
{
public function getName() : string
{
return 'items';
}
public function failSilently(): bool
{
return true;
}
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.