bestyii / yii2-xmlparser
yii2 xml 请求解析器
v1.0.0
2022-09-21 07:21 UTC
Requires
- php: >=5.4.0
- yiisoft/yii2: 2.0.*
Requires (Dev)
- phpunit/phpunit: 4.4.*
This package is not auto-updated.
Last update: 2024-09-19 14:52:27 UTC
README
概览
这是一个帮助您处理XML请求的库。众所周知,Yii2 提供了一个内置的请求解析器用于处理类似于JSON的请求,即 yii\web\JsonParser。有时,我们需要处理XML请求,因此这个库应运而生。
安装
将 bestyii/yii2-xmlparser 添加到 composer.json 文件中,您可以将版本指定为 *
$ composer install //or run $ composer update
也可以这样做
$ composer require bestyii/yii2-xmlparser --prefer-dist
用法
# file app/config/main.php [your configuration file]
<?php
return [
'components' => [
'request' => [
'parsers' => [
'text/xml' => 'bestyii\xml\parser\XmlParser',
'application/xml' => 'bestyii\xml\parser\XmlParser',
],
],
],
];
测试
$ phpunit