thapp/xmlconf

Xml配置工具

v1.0.0 2013-04-28 15:03 UTC

This package is not auto-updated.

Last update: 2024-09-23 11:09:17 UTC


README

Build Status

摘要

这个包允许您从XML配置文件中轻松地引导数据、对象或任何内容。然而,XML配置文件必须与提供的xsd模式验证。

安装

将thapp/xmlconf添加到composer.json的要求中

{
    "require": {
        "thapp/xmlconf": "1.0.*"
    }
}

然后运行composer updatecomposer install

下一步是告诉Laravel加载serviceprovider。在app/config/app.php中添加

  // ...
  'Thapp\XmlConf\XmlConfServiceProvider' 
  // ...

providers数组。

发布配置

php artisan config:publish thapp/xmlconfig

示例

这个包提供了一个示例目录,可以帮助您快速开始。

为了初步了解,您可以复制这个包中包含的storage/sections/config.xmlapp/storage/sections/config.xml

接下来,创建一个新的路由。例如:

Route::get('/examples', function () use ($app) {
    $SectionRepository = new Thapp\XmlConf\Examples\Sections\Repository($app['xmlconf.sections']);
    var_dump($SectionRepository);
});

常规

文件结构

- Vendor/
  - ReaderName/
    - Schema/
      - readername.xsd
    - ReaderNameSimpleXml.php
    - ReaderNameConfigReader.php

xml存储结构

- app/
  - storage/
    - ReaderName/
      - config.xml