{"id":17085194,"url":"https://github.com/tucker-eric/laravel-xml-middleware","last_synced_at":"2025-04-12T20:32:43.215Z","repository":{"id":13894621,"uuid":"75261775","full_name":"Tucker-Eric/laravel-xml-middleware","owner":"Tucker-Eric","description":"A Laravel Middleware to accept XML requests","archived":false,"fork":false,"pushed_at":"2024-03-03T02:07:16.000Z","size":19,"stargazers_count":18,"open_issues_count":2,"forks_count":10,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-09T11:19:04.317Z","etag":null,"topics":["laravel","laravel-middleware","laravel-xml","xml","xml-request"],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Tucker-Eric.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-12-01T06:17:49.000Z","updated_at":"2023-02-17T17:45:33.000Z","dependencies_parsed_at":"2024-03-03T03:30:43.639Z","dependency_job_id":null,"html_url":"https://github.com/Tucker-Eric/laravel-xml-middleware","commit_stats":{"total_commits":15,"total_committers":9,"mean_commits":"1.6666666666666667","dds":0.6666666666666667,"last_synced_commit":"a1aa79c55417d5eda7736143494dcf3304367f41"},"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Tucker-Eric%2Flaravel-xml-middleware","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Tucker-Eric%2Flaravel-xml-middleware/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Tucker-Eric%2Flaravel-xml-middleware/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Tucker-Eric%2Flaravel-xml-middleware/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Tucker-Eric","download_url":"https://codeload.github.com/Tucker-Eric/laravel-xml-middleware/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248630264,"owners_count":21136405,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["laravel","laravel-middleware","laravel-xml","xml","xml-request"],"created_at":"2024-10-14T13:23:33.822Z","updated_at":"2025-04-12T20:32:42.857Z","avatar_url":"https://github.com/Tucker-Eric.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# laravel-xml-middleware\n\n[![Latest Stable Version](https://poser.pugx.org/tucker-eric/laravel-xml-middleware/v/stable)](https://packagist.org/packages/tucker-eric/laravel-xml-middleware)\n[![Total Downloads](https://poser.pugx.org/tucker-eric/laravel-xml-middleware/downloads)](https://packagist.org/packages/tucker-eric/laravel-xml-middleware)\n[![License](https://poser.pugx.org/tucker-eric/laravel-xml-middleware/license)](https://packagist.org/packages/tucker-eric/laravel-xml-middleware)\n[![Build Status](https://travis-ci.org/Tucker-Eric/laravel-xml-middleware.svg?branch=master)](https://travis-ci.org/Tucker-Eric/laravel-xml-middleware)\n\nA Laravel Middleware to accept XML requests\n\n## Configuration\n### Install Through Composer\n```\ncomposer require tucker-eric/laravel-xml-middleware\n```\n\n### Register The Service Provider\nIn `config/app.php` add the service provider to the providers array:\n\n```php\n    'providers' =\u003e [\n        //Other Service Providers\n        XmlMiddleware\\XmlRequestServiceProvider::class,\n    ];\n```\n\n### Register the middleware\nIn `app/Http/Kernel.php`\n\n```php\n    protected $routeMiddleware = [\n            /// Other Middleware\n            'xml' =\u003e \\XmlMiddleware\\XmlRequestMiddleware::class,\n        ];\n```\n\n### Applying the middleware to routes\nAdd the middleware to your route as desired\n\n#### Controller Middleware\n```php\nclass MyController extends Controller\n{\n    public function __construct()\n    {\n        $this-\u003emiddleware('xml');\n    }\n}\n```\n\n#### Route Middleware\n```php\n    Route::group(['middleware' =\u003e 'xml'], function() {\n        Route::post('my-api-endpoint', 'MyOtherController@store');\n    });\n```\n```php\n        Route::post('my-api-endpoint', 'MyOtherController@store')-\u003emiddleware('xml');\n```\n### Accessing XML Input With Middleware\nIf 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-\u003eall()`:\n\n```php\n\nuse Illuminate\\Http\\Request;\nuse App\\Http\\Controllers\\Controller;\n\nclass MyController extends Controller\n{\n    public function __construct()\n    {\n        $this-\u003emiddleware('xml');\n    }\n    \n    public function store(Request $request)\n    {\n        $request-\u003eall();\n    }\n}\n```\n### Accessing XML Input\nTo access the xml input without the middleware use the `xml()` method on the `Request`:\n\n```php\nuse Illuminate\\Http\\Request;\nuse App\\Http\\Controllers\\Controller;\n\nClass MyOtherController extends Controller\n{\n    public function store(Request $request)\n    {\n        $xml = $request-\u003exml();\n    }\n}\n```\n\nTo access the xml request as an object pass `false` to the `xml()` method:\n\n```php\nuse Illuminate\\Http\\Request;\nuse App\\Http\\Controllers\\Controller;\n\nClass MyOtherController extends Controller\n{\n    public function store(Request $request)\n    {\n        $xml = $request-\u003exml(false);\n    }\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftucker-eric%2Flaravel-xml-middleware","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftucker-eric%2Flaravel-xml-middleware","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftucker-eric%2Flaravel-xml-middleware/lists"}