PHP code example of halimonalexander / registry

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

    

halimonalexander / registry example snippets


use HalimonAlexander\Registry\Registry;

$registry = Registry::getInstance();

$registry->set('key1', 1);
//...
if ($registry->has('key1')) {
    $var = $registry->get('key1');
}

$registry->set('db', new \PDO());
//...
/** @var \PDO|null $db */
$db = $registry->getByClassname(\PDO::class);