New

Just launched: Vueblocks, a brand-new search engine for Vue packages! Explore Vueblocks →

jailtonsc/laravel-response-xml

Add the method xml integrating the laravel's response, converting eloquent return to XML.
316,662 47
Install
composer require jailtonsc/laravel-response-xml
Latest Version:v3.0.1
PHP:>=5.5.9
License:MIT
Last Updated:Jun 30, 2018
Links: GitHub  ·  Packagist
Maintainer: jailtonsc

Laravel Response XML

Add the method "xml" integrating the laravel's response, converting eloquent return to XML.

Total Downloads Latest Stable Version Latest Unstable Version

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

Related Packages

mtownsend/response-xml

The missing XML support for Laravel's Response class.

1,469,585 104
spitoglou/multi-api

Multiple response formats

35 0
ngmy/eloquent-serialized-lob

Eloquent Serialized LOB is a trait for Laravel Eloquent models that allows Seria...

2,301 1
laravie/parser

XML Document Parser for PHP

2,266,825 230

Version History

Version Released PHP License
v3.0.1 >=5.5.9 MIT
v3.0 >=5.5.9 MIT
v2.3.2 >=5.5.9 MIT
v2.3.1 >=5.5.9 MIT
v2.3 >=5.5.9 MIT