PHP code example of arcanum / parameter-tree

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

    

arcanum / parameter-tree example snippets


$dbConfig = new ParameterTree(
    [   
        "master"=>[
            "host"=>"db.com",
            "user"=>"DB-DUDE",
            "pass"=>"super-secret123",
            "port"=>"3306"
        ]
    ]
);
echo $dbConfig->get("master.host","localhost"); //db.com
echo $dbConfig->get("slave.host","localhost"); //localhost
var_dump($dbConfig->hasKey("master.host")); //true
var_dump($dbConfig->hasKey("master.soup")); //false
$dbConfig->set("slave.pass","abc123");
var_dump($config->toArray()); // ["master"=>["host"=>"db.com","user"=>"DB-DUDE","pass"=>"super-secret123","port"=>"3306],"slave"=>["pass"=>"abc123"]]