m3y/phini

ini文件实用工具

0.2 2014-11-13 17:25 UTC

This package is not auto-updated.

Last update: 2024-09-24 02:52:36 UTC


README

Build Status Coverage Status Latest Stable Version License

概要

phini是一个用于使应用程序更方便地使用ini配置文件值的工具类。

安装

创建包含以下内容的composer.json文件,

{
  "require": {
    "m3y/phini": "0.2"
  }
}

使用composer进行安装

$ composer install

使用方法

示例ini文件

key3[] = value31
key3[] = value32
key3[] = value33

[section_one]
key11 = value11
key12 = value12
key13 = value13

[section_two]
key21 = value21
key22 = value22
key23 = value23

考虑使用部分

<?php

require 'vendor/autoload.php';

$ini = new M3y\Phini\Phini('/path/to/inifile.ini', true);

print $ini->section_two->key21; // value21
print $ini->key3[0]; // value31

不考虑使用部分

<?php

require 'vendor/autoload.php';

$ini = new M3y\Phini\Phini('/path/to/inifile.ini');
print $ini->key11; // value11
print $ini->key3[0]; // value31

测试执行

$ phpunit