塔坦 / laravel-xml-response
为Laravel响应添加了一个方法来处理XML响应,并将Eloquent返回值转换为XML。
v6.0.1
2022-09-11 12:26 UTC
Requires
- php: >=5.5.9
- ext-simplexml: *
- illuminate/support: >5.0.0
README
为Laravel响应添加了一个方法来处理XML响应,并将Eloquent返回值转换为XML。
Composer 安装
composer require php-monsters/laravel-xml-response
与Laravel 5.0+集成
对于Laravel < 5.6,请将其添加到config/app.php
PhpMonsters\XmlResponse\XmlResponseServiceProvider::class
发布
php artisan vendor:publish --provider="PhpMonsters\XmlResponse\XmlResponseServiceProvider"
示例
// basic usage with default config from xml.php file Route::get('/', function () { return response()->xml(User::all()); }); // custom template like: '<result></result>' Route::get('/foo', function () { return response()->xml(['foo' => 1, 'bar' => 2, 'baz' => 3], [], '<result></result>); });
团队
本组件由以下人员开发,以及许多杰出的贡献者。
许可证
Laravel XML Response 是开源软件,许可协议为MIT许可证