PHP code example of tartan / laravel-xml-response

1. Go to this page and download the library: Download tartan/laravel-xml-response library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

tartan / laravel-xml-response example snippets


composer 

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>);
});