arcanum / parameter-tree
多维度参数树(如POST/GET、配置等)的命名空间访问器
2.0.1
2016-08-05 00:10 UTC
Requires
- php: >=5.4
This package is not auto-updated.
Last update: 2024-09-28 16:51:50 UTC
README
ParameterTree是一个多维、命名空间的参数包,简化了对多维数组的访问(如配置、GET/POST/SESSION参数等),具有默认返回值和类型转换。
基本用法
$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"); // 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"]]
许可证
ParameterTree是开源软件,许可协议为MIT协议