thapp / xmlconf
Xml配置工具
v1.0.0
2013-04-28 15:03 UTC
Requires
- php: >= 5.3.7
- illuminate/cache: 4.0.*
Requires (Dev)
- mikey179/vfsstream: dev-master
- mockery/mockery: 0.7.2
This package is not auto-updated.
Last update: 2024-09-23 11:09:17 UTC
README
摘要
这个包允许您从XML配置文件中轻松地引导数据、对象或任何内容。然而,XML配置文件必须与提供的xsd模式验证。
安装
将thapp/xmlconf添加到composer.json的要求中
{ "require": { "thapp/xmlconf": "1.0.*" } }
然后运行composer update
或composer install
下一步是告诉Laravel加载serviceprovider。在app/config/app.php
中添加
// ... 'Thapp\XmlConf\XmlConfServiceProvider' // ...
到providers
数组。
发布配置
php artisan config:publish thapp/xmlconfig
示例
这个包提供了一个示例目录,可以帮助您快速开始。
为了初步了解,您可以复制这个包中包含的storage/sections/config.xml
到app/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