PHP code example of michalcarson / symfony-xml-response
1. Go to this page and download the library: Download michalcarson/symfony-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/ */
michalcarson / symfony-xml-response example snippets
$xr = new XmlResponse();
// changing the default root element
$xr->root_element_name = $view;
// data must be set after the root element
$response = $xr->setData($data);
return $response;
$response = new XmlResponse($data);
return $response;
return new XmlResponse($data);
// using the static create() method
$response = XmlResponse::create($data);
return $response;
// specifying optional return code and headers
$response = new XmlResponse($data, 202, array('Foo-Header' => 'bar'));
return $response;