orchestra/parser
最新稳定版本:v10.0.0
Composer 安装命令:
composer require orchestra/parser
包简介
XML Document Parser for Laravel and PHP
README 文档
README
Parser Component is a framework agnostic package that provide a simple way to parse XML to array without having to write a complex logic.
Imagine if you can parse
<api> <user followers="5"> <id>1</id> <email>crynobone@gmail.com</email> </user> </api>
to
$user = [ 'id' => '1', 'email' => 'crynobone@gmail.com', 'followers' => '5' ];
by just writing this:
use Orchestra\Parser\Xml\Facade as XmlParser; $xml = XmlParser::load('path/to/above.xml'); $user = $xml->parse([ 'id' => ['uses' => 'user.id'], 'email' => ['uses' => 'user.email'], 'followers' => ['uses' => 'user::followers'], ]);
Version Compatibility
| Laravel | Parser |
|---|---|
| 6.x | 4.x |
| 7.x | 5.x |
| 8.x | 6.x |
| 9.x | 7.x |
| 10.x | 8.x |
| 11.x | 9.x |
| 12.x | 10.x |
Installation
To install through composer, run the following command from terminal:
composer require "orchestra/parser"
Configuration
Next add the service provider in config/app.php.
'providers' => [ // ... Orchestra\Parser\XmlServiceProvider::class, ],
Aliases
You might want to add Orchestra\Parser\Xml\Facade to class aliases in config/app.php:
'aliases' => [ // ... 'XmlParser' => Orchestra\Parser\Xml\Facade::class, ],
统计信息
- 总下载量: 1.67M
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 464
- 点击次数: 1
- 依赖项目数: 5
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2014-04-29