Download the PHP package mtownsend/request-xml without Composer

On this page you can find all versions of the php package mtownsend/request-xml. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package request-xml

The missing XML support for Laravel's Request 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:

Middleware

It's important to register the middleware so your application can convert an XML request and merge it into the Request object. You will then be able to run XML through Laravel's powerful validation system.

Please note:

Once you register the middleware, you do not need to do anything special to access your request xml. It will be available in the Request object like it would if it was a json or form request.

To setup the middleware, open up your app/Http/Kernel.php file.

To add the middleware globally:

To add the middleware to web routes only:

To add the middleware to api routes only:

Or, if you want named middleware for specific routes:

Quick start

Determine if the request wants an xml response

Determine if the request contains xml

Get the converted xml as an array

Methods

Request method

->wantsXml()

Works very similar to Laravel's ->wantsJson() method by returning a boolean. It will tell you if the incoming request would like to receive an XML response back.

Request method

->isXml()

Returns a boolean. This will tell you if the incoming request is XML.

Request method

->xml()

Returns an array. This converts the XML request into a PHP array. You are free to cast it to an object:

Or wrap it in a collection:

Exceptions

In the event invalid XML is received in a request, the application will throw an Exception containing the raw, invalid XML. If you would like to handle this exception whenever it occurs in your application, you can easily catch it and supply your own code in your applications app/Exceptions/Handler.php like so:

Purpose

Have you ever wondered why Laravel offered useful methods for transforming data into JSON but completely forgot about XML? This package aims to add the missing XML functionality to Laravel's Request class. Your Laravel application may now detect and auto-merge incoming XML requests into the Request object. You can run an XML request through Laravel's built in validation system - it just works! XML's days of being a second class citizen in your Laravel app have come to an end.

Other packages you may be interested in

Credits

Testing

You can run the tests with:

License

The MIT License (MIT). Please see License File for more information.


All versions of request-xml with dependencies

PHP Build Version
Package Version
Requires php Version ~7.0|~8.0
illuminate/support Version ~5.5.0|~5.6.0|~5.7.0|~5.8.0|~6.0|^7.0|^8.0|^9.0|^10.0|^11.0
illuminate/http Version ~5.5.0|~5.6.0|~5.7.0|~5.8.0|~6.0|^7.0|^8.0|^9.0|^10.0|^11.0
mtownsend/xml-to-array Version ^1.0|^2.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package mtownsend/request-xml contains the following files

Loading the files please wait ....