承接 jamesmoss/toml 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

jamesmoss/toml

最新稳定版本:1.1.1

Composer 安装命令:

composer require jamesmoss/toml

包简介

A parser for TOML implemented in PHP.

README 文档

README

Build Status

A parser for TOML written in PHP. Currently supports 100% of the TOML spec: dates, multiline arrays, key groups - the lot (including all of the more minor restrictions such as same-type arrays and key group override rules).

Requirements

  • PHP 5.3
  • Composer

Installation

Use Composer to install the Toml package. Package details can be found on Packagist.org.

Add the following to your composer.json and run composer update.

"require": {
	//...
    "jamesmoss/toml": "dev-master"
}

You can use this lib without Composer but you'll need to provide your own PSR-0 compatible autoloader. Really, you should just use Composer.

Use

Toml\Parser has two static methods fromString and fromFile, which are self explanatory. Both return an associative array. If your TOML doc can't be parsed an Exception will be thrown with a useful error message.

use Toml\Parser;

// Load directly from a string
$toml = Parser::fromString('name = "James Moss"');

var_dump($toml['name']); // outputs 'James Moss'.

// Load from a file instead
$toml = Parser::fromFile(__DIR__ . '/config.toml');

Running tests

There is 100% test coverage at the moment. If you'd like to run the tests yourself, use the following:

$ composer update
$ phpunit

Contributing

The TOML spec is changing often as it's in its infancy; if you spot something I've missed fork this repo, create a new branch and submit a pull request. Make sure any features you add are covered by unit tests.

Todo

  • Better documentation and docblocks
  • More semantic exceptions to be thrown, standardise the error message format.

统计信息

  • 总下载量: 31.12k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 32
  • 点击次数: 0
  • 依赖项目数: 14
  • 推荐数: 12

GitHub 信息

  • Stars: 31
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2013-02-24