PHP code example of daltcore / registery-ng

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

    

daltcore / registery-ng example snippets




namespace App\Registeries;

use DALTCORE\Registery\Registery;

class Config extends Registery {
    
    /**
    * These properties are optional!
    */
    protected $engine = Registery::JSONDB; // Registery::MEMORYDB Registery::NULLDB
    protected $prefix = ''; // Prefix for the "keys"
    protected $table = 'configs'; // Table name
}

$config = Config::get();
dump($config);

$config->fill(['foo' => 'bar']);
dump($config);
$config->save();

$config->foo = 'baz';
dump($config);
$config->save();

$config->update(['foo' => 'bar']);
dump($config);

dump($config->foo); // baz

dump($config->get()); // array
 php
DALTCORE\Registery\RegisteryServiceProvider::class,
 php
'Registery' => DALTCORE\Registery\Facade::class,