v1.1.1
1.1.1.0Add the method xml integrating the laravel's response, converting eloquent return to XML.
MIT
The Requires
- php >=5.5.9
- robrichards/xmlseclibs ^2.0
laravel xml eloquent response
Wallogit.com
2017 © Pedro Peláez
Add the method xml integrating the laravel's response, converting eloquent return to XML.
Add the method "xml" integrating the laravel's response, converting eloquent return to XML., (*1)
composer require jailtonsc/laravel-response-xml
Add in config/app.php in place providers, (*3)
XmlResponse\XmlResponseServiceProvider::class
Add in config/app.php in place aliases, (*4)
'Xml' => XmlResponse\Facades\XmlFacade::class
php artisan vendor:publish
Route::get('/', function () {
return response()->xml(User::all());
});
With status code, (*5)
Route::get('/', function () {
return response()->xml(User::all(), 404);
});
Setting by code, (*6)
$config = [
'template' => '<test></test>',
'rowName' => 'name'
];
Route::get('/', function () {
return response()->xml(User::all(), 200, $config);
});
Return string xml, (*7)
$xml = Xml::asXml(User::all());
Or, (*8)
$config = [
'template' => '<test></test>',
'rowName' => 'name'
];
$xml = Xml::asXml(User::all(), $config);
file config/xml.php, (*9)
template: xml template., (*10)
caseSensitive: case sensitive xml tag., (*11)
showEmptyField: Show empty field., (*12)
charset: encoding., (*13)
rowName: line name if it is an array., (*14)
The Laravel Response XML is open-sourced software licensed under the MIT license, (*15)
Add the method xml integrating the laravel's response, converting eloquent return to XML.
MIT
laravel xml eloquent response