PHPackages                             hobbily/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. hobbily/laravel-xml-middleware

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

hobbily/laravel-xml-middleware
==============================

A Laravel Middleware to accept XML requests

1.2.0(8y ago)024MITPHP

Since Dec 1Pushed 8y ago1 watchersCompare

[ Source](https://github.com/hobbily/laravel-xml-middleware)[ Packagist](https://packagist.org/packages/hobbily/laravel-xml-middleware)[ RSS](/packages/hobbily-laravel-xml-middleware/feed)WikiDiscussions master Synced 2w ago

READMEChangelogDependencies (2)Versions (6)Used By (0)

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

[](#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' => XmlRequestMiddleware::class,
        ];
```

### Applying the middleware to routes

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

Add the middleware to your 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');
    });
```

### 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

29

—

LowBetter than 57% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity67

Established project with proven stability

 Bus Factor1

Top contributor holds 50% of commits — single point of failure

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 ~74 days

Total

5

Last Release

3199d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/4475757?v=4)[hobbily](/maintainers/hobbily)[@hobbily](https://github.com/hobbily)

---

Top Contributors

[![Tucker-Eric](https://avatars.githubusercontent.com/u/6483755?v=4)](https://github.com/Tucker-Eric "Tucker-Eric (5 commits)")[![xsilen-tt](https://avatars.githubusercontent.com/u/90232688?v=4)](https://github.com/xsilen-tt "xsilen-tt (2 commits)")[![andrewmclagan](https://avatars.githubusercontent.com/u/1073259?v=4)](https://github.com/andrewmclagan "andrewmclagan (1 commits)")[![austinkregel](https://avatars.githubusercontent.com/u/5355937?v=4)](https://github.com/austinkregel "austinkregel (1 commits)")[![hobbily](https://avatars.githubusercontent.com/u/4475757?v=4)](https://github.com/hobbily "hobbily (1 commits)")

---

Tags

requestmiddlewarelaravelxmlxml-middlewarexml request

### Embed Badge

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

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

###  Alternatives

[psalm/plugin-laravel

Psalm plugin for Laravel

3345.1M337](/packages/psalm-plugin-laravel)[tucker-eric/laravel-xml-middleware

A Laravel Middleware to accept XML requests

181.2M](/packages/tucker-eric-laravel-xml-middleware)[spatie/laravel-responsecache

Speed up a Laravel application by caching the entire response

2.8k8.7M64](/packages/spatie-laravel-responsecache)[bmatovu/laravel-xml

Laravel XML Support

88282.0k](/packages/bmatovu-laravel-xml)[laravel/mcp

Rapidly build MCP servers for your Laravel applications.

77018.2M122](/packages/laravel-mcp)[api-platform/laravel

API Platform support for Laravel

59156.3k11](/packages/api-platform-laravel)

PHPackages © 2026

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