PHPackages                             tucker-eric/laravel-xml-middleware - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Parsing &amp; Serialization](/categories/parsing)
4. /
5. tucker-eric/laravel-xml-middleware

ActiveLibrary[Parsing &amp; Serialization](/categories/parsing)

tucker-eric/laravel-xml-middleware
==================================

A Laravel Middleware to accept XML requests

1.5.0(2y ago)181.2M↓29.4%9[2 issues](https://github.com/Tucker-Eric/laravel-xml-middleware/issues)MITPHP

Since Dec 1Pushed 2y ago2 watchersCompare

[ Source](https://github.com/Tucker-Eric/laravel-xml-middleware)[ Packagist](https://packagist.org/packages/tucker-eric/laravel-xml-middleware)[ RSS](/packages/tucker-eric-laravel-xml-middleware/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (8)Dependencies (3)Versions (10)Used By (0)

laravel-xml-middleware
======================

[](#laravel-xml-middleware)

[![Latest Stable Version](https://camo.githubusercontent.com/30567637cae650fff16cf6e09715c7759e2a7dd0110131548cea5bd2f7c28f9a/68747470733a2f2f706f7365722e707567782e6f72672f7475636b65722d657269632f6c61726176656c2d786d6c2d6d6964646c65776172652f762f737461626c65)](https://packagist.org/packages/tucker-eric/laravel-xml-middleware)[![Total Downloads](https://camo.githubusercontent.com/e36dfd62f59999e2c60c7d1944ec41561872f37531c96accc83acd79428bdf18/68747470733a2f2f706f7365722e707567782e6f72672f7475636b65722d657269632f6c61726176656c2d786d6c2d6d6964646c65776172652f646f776e6c6f616473)](https://packagist.org/packages/tucker-eric/laravel-xml-middleware)[![License](https://camo.githubusercontent.com/576e073b96b6d80cebe83828d7ea42aa3441fc3a90b41b4b6b787d4bb9716c15/68747470733a2f2f706f7365722e707567782e6f72672f7475636b65722d657269632f6c61726176656c2d786d6c2d6d6964646c65776172652f6c6963656e7365)](https://packagist.org/packages/tucker-eric/laravel-xml-middleware)[![Build Status](https://camo.githubusercontent.com/5472bb80ad2e1eb59d39f5d63b4f29cf8b80378a3257fd50282a249144cebf4c/68747470733a2f2f7472617669732d63692e6f72672f5475636b65722d457269632f6c61726176656c2d786d6c2d6d6964646c65776172652e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/Tucker-Eric/laravel-xml-middleware)

A Laravel Middleware to accept XML requests

Configuration
-------------

[](#configuration)

### Install Through Composer

[](#install-through-composer)

```
composer require tucker-eric/laravel-xml-middleware

```

### Register The Service Provider

[](#register-the-service-provider)

In `config/app.php` add the service provider to the providers array:

```
    'providers' => [
        //Other Service Providers
        XmlMiddleware\XmlRequestServiceProvider::class,
    ];
```

### Register the middleware

[](#register-the-middleware)

In `app/Http/Kernel.php`

```
    protected $routeMiddleware = [
            /// Other Middleware
            'xml' => \XmlMiddleware\XmlRequestMiddleware::class,
        ];
```

### Applying the middleware to routes

[](#applying-the-middleware-to-routes)

Add the middleware to your route as desired

#### Controller Middleware

[](#controller-middleware)

```
class MyController extends Controller
{
    public function __construct()
    {
        $this->middleware('xml');
    }
}
```

#### Route Middleware

[](#route-middleware)

```
    Route::group(['middleware' => 'xml'], function() {
        Route::post('my-api-endpoint', 'MyOtherController@store');
    });
```

```
        Route::post('my-api-endpoint', 'MyOtherController@store')->middleware('xml');
```

### Accessing XML Input With Middleware

[](#accessing-xml-input-with-middleware)

If you are using the middleware it will automatically inject the xml into the request as an array and you you can access the xml data in your controller with the `$request->all()`:

```
use Illuminate\Http\Request;
use App\Http\Controllers\Controller;

class MyController extends Controller
{
    public function __construct()
    {
        $this->middleware('xml');
    }

    public function store(Request $request)
    {
        $request->all();
    }
}
```

### Accessing XML Input

[](#accessing-xml-input)

To access the xml input without the middleware use the `xml()` method on the `Request`:

```
use Illuminate\Http\Request;
use App\Http\Controllers\Controller;

Class MyOtherController extends Controller
{
    public function store(Request $request)
    {
        $xml = $request->xml();
    }
}
```

To access the xml request as an object pass `false` to the `xml()` method:

```
use Illuminate\Http\Request;
use App\Http\Controllers\Controller;

Class MyOtherController extends Controller
{
    public function store(Request $request)
    {
        $xml = $request->xml(false);
    }
}
```

###  Health Score

42

—

FairBetter than 90% of packages

Maintenance18

Infrequent updates — may be unmaintained

Popularity45

Moderate usage in the ecosystem

Community19

Small or concentrated contributor base

Maturity69

Established project with proven stability

 Bus Factor2

2 contributors hold 50%+ of commits

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~346 days

Recently: every ~339 days

Total

8

Last Release

1028d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/bc8a916379f694da7abf77303b5484b45853dedb5e65f21269d66aab72f681b7?d=identicon)[tucker-eric](/maintainers/tucker-eric)

---

Top Contributors

[![Tucker-Eric](https://avatars.githubusercontent.com/u/6483755?v=4)](https://github.com/Tucker-Eric "Tucker-Eric (8 commits)")[![samuelhowell](https://avatars.githubusercontent.com/u/4999977?v=4)](https://github.com/samuelhowell "samuelhowell (3 commits)")[![georgeboot](https://avatars.githubusercontent.com/u/884482?v=4)](https://github.com/georgeboot "georgeboot (2 commits)")[![fransjooste1](https://avatars.githubusercontent.com/u/11923529?v=4)](https://github.com/fransjooste1 "fransjooste1 (1 commits)")[![Adewagold](https://avatars.githubusercontent.com/u/19472085?v=4)](https://github.com/Adewagold "Adewagold (1 commits)")[![laravel-shift](https://avatars.githubusercontent.com/u/15991828?v=4)](https://github.com/laravel-shift "laravel-shift (1 commits)")[![austinkregel](https://avatars.githubusercontent.com/u/5355937?v=4)](https://github.com/austinkregel "austinkregel (1 commits)")[![andrewmclagan](https://avatars.githubusercontent.com/u/1073259?v=4)](https://github.com/andrewmclagan "andrewmclagan (1 commits)")

---

Tags

laravellaravel-middlewarelaravel-xmlxmlxml-requestrequestmiddlewarelaravelxmlxml-middlewarexml request

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/tucker-eric-laravel-xml-middleware/health.svg)

```
[![Health](https://phpackages.com/badges/tucker-eric-laravel-xml-middleware/health.svg)](https://phpackages.com/packages/tucker-eric-laravel-xml-middleware)
```

###  Alternatives

[bmatovu/laravel-xml

Laravel XML Support

91270.4k](/packages/bmatovu-laravel-xml)[ultrono/laravel-sitemap

Sitemap generator for Laravel 11, 12 and 13

36412.6k6](/packages/ultrono-laravel-sitemap)[json-mapper/laravel-package

The JsonMapper package for Laravel

25170.4k3](/packages/json-mapper-laravel-package)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
