PHP code example of gong023 / tiny_config_php

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

    

gong023 / tiny_config_php example snippets


use \TinyConfig\TinyConfig;

TinyConfig::set('hello', 'world');
TinyConfig::set('foo', 'bar');

TinyConfig::get('hello');
=> 'world'

TinyConfig::get('unknownKey');
=> Throws TinyConfigEmptyException

TinyConfig::has('hello');
=> true

TinyConfig::getAll();
=> ['hello' => 'world', 'foo' => 'bar'];

TinyConfig::getKeys();
=> ['hello', 'foo'];

TinyConfig::delete('hello');
TinyConfig::getAll();
=> ['foo' => 'bar'];

TinyConfig::deleteAll();
TinyConfig::getAll();
=> [];