jailtonsc/laravel-response-xml
最新稳定版本:v3.0.1
Composer 安装命令:
composer require jailtonsc/laravel-response-xml
包简介
Add the method xml integrating the laravel's response, converting eloquent return to XML.
README 文档
README
Add the method "xml" integrating the laravel's response, converting eloquent return to XML.
Composer Installation
composer require jailtonsc/laravel-response-xml
Integration with Laravel 5.*
Add in config/app.php in place providers
XmlResponse\XmlResponseServiceProvider::class
Add in config/app.php in place aliases
'Xml' => XmlResponse\Facades\XmlFacade::class
Publish
php artisan vendor:publish
Example
Route::get('/', function () { return response()->xml(User::all()); });
With status code
Route::get('/', function () { return response()->xml(User::all(), 404); });
Setting by code
$config = [ 'template' => '<test></test>', 'rowName' => 'name' ]; Route::get('/', function () { return response()->xml(User::all(), 200, $config); });
Return string xml
$xml = Xml::asXml(User::all());
Or
$config = [ 'template' => '<test></test>', 'rowName' => 'name' ]; $xml = Xml::asXml(User::all(), $config);
Configuration
file config/xml.php
template: xml template.
caseSensitive: case sensitive xml tag.
showEmptyField: Show empty field.
charset: encoding.
rowName: line name if it is an array.
License
The Laravel Response XML is open-sourced software licensed under the MIT license
统计信息
- 总下载量: 260.43k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 48
- 点击次数: 2
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 未知