{"repo":"mtownsend5512/response-xml","free":true,"listed":false,"github":"https://github.com/mtownsend5512/response-xml","clone":"git clone https://github.com/mtownsend5512/response-xml.git","description":"The missing XML support for Laravel's Response class.","language":"PHP","stars":104,"topics":["laravel","response","xml","api","array-to-xml","laravel-package"],"license":"MIT","category":"api-integrations-sdks","readme_excerpt":"The missing XML support for Laravel's Response class. This package is designed to work with the Laravel framework. Installation Install via composer: Registering the service provider For Laravel 5.4 and lower, add the following line to your config/app.php : For Laravel 5.5 and greater, the package will auto register the provider for you. Using Lumen To register the service provider, add the following line to app/bootstrap/app.php : Quick start Respond with xml Respond with xml from a collection or eloquent query You may also pass a collection to be transformed into xml. Respond with existing xml If you already have xml, you can pass it to the xml method to respond. Respond with the request's preferred format (xml/json) If you want to respond with either xml or json on the fly without writing if/else statements you may use the - preferredFormat() method. This will take the request's Accept header and try to determine which format the request wants to be served. If this header is nonexistent, it will default to json. Note: when using this method, it will automatically set your response's Content-Type header to match the request's Accept header. Methods and arguments Response method - xml($xml, $status = 200, array $headers = [], $xmlRoot = 'response', $encoding = null) The $xml argument is the data you want to be transformed into xml (may also be a premade xml string). $status is the http code your response will send. $headers is an array of key/values of http headers your resp","default_branch":null,"files":null,"tree":[],"storefront":"/r/mtownsend5512","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/mtownsend5512/response-xml/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}