New

Just launched: Vueblocks, a brand-new search engine for Vue packages! Explore Vueblocks →

softonic/laravel-psr15-bridge

Laravel PSR-15 middleware bridge
119,261 9
Install
composer require softonic/laravel-psr15-bridge
Latest Version:5.0.0
PHP:>=8.5
Laravel:12
Older releases:5 – 11
License:Apache-2.0
Last Updated:Jan 12, 2026
Links: GitHub  ·  Packagist
Maintainer: Joskfg

Laravel PSR-15 Middleware Bridge

Latest Version Software License Build Status Total Downloads

This package provides a Laravel middleware bridge for PSR-15 inspired in jshannon63/laravel-psr15-middleware.

Requirements

  • PHP >= 8.5
  • Laravel 12.x

Installation

To install, use composer:

composer require softonic/laravel-psr15-bridge

You are ready to use it!

Usage

The bridge adapter receive a PSR-15 middleware via injection, so the bridge is transparent for Laravel and you can use it as any other middleware.

Example based on OpenApi Validation Middleware:

Wrapping OpenApi Validation Middleware within the bridge.

// app/Providers/AppServiceProvider.php

use Softonic\Laravel\Middleware\Psr15Bridge\Psr15MiddlewareAdapter;

/**
 * Register any application services.
 *
 * @return void
 */
public function register()
{
    $this->app->bind(OpenApiValidation::class, function () {

        // Setup your PSR-15 middleware here
        $validator = new \HKarlstrom\Middleware\OpenApiValidation('schema.json');
    
        // Return it wrapped in the adapter to make Laravel accept it
        return Psr15MiddlewareAdapter::adapt($validator);
    });
}

Now you can use it anywhere or for example generate an alias.

// app/Http/Kernel.php

protected $routeMiddleware = [
    ...
    'openapi-validation' => OpenApiValidation::class,
];

Check laravel middleware for more information.

How it works

In the next diagram you can see the request and response flow.

psr-15 bridge flow

As you can see, when you execute Psr15MiddlewareAdapter::adapt($validator);, you are adding an envelop to the PSR-15 middleware that converts the request and response transparently for the middleware format Laravel expects.

Testing

softonic/laravel-psr15-bridge has a PHPUnit test suite and a coding style compliance test suite using PHP CS Fixer.

To run the tests, run the following command from the project folder.

$ docker compose run --rm test

To run PHPUnit only:

$ docker compose run --rm phpunit

To check code style:

$ docker compose run --rm php composer run phpcs

To fix code style issues:

$ docker compose run --rm fixcs

License

The Apache 2.0 license. Please see LICENSE for more information.

Related Packages

maskulabs/inertia-psr

PSR-based Inertia helpers and middleware integration for PHP applications

617 4
shin1x1/laravel-force-https-url-scheme

Force https url schema middleware for Laravel 5

26,582 25
minhd/solr-client

A PHP Solr Client

1,772 1
laravel-dev-common/union-middleware

Laravel dev middleware util

95 0
fsy-laravel/middleware-checklogin

Laravel dev mid_checklogin util

55 0

Version History

Version Released PHP Laravel License
5.0.0 >=8.5 ^12.0 Apache-2.0
4.1.1 >=8.1 ^9.0 || ^10.0 || ^11.0 Apache-2.0
4.1.0 >=8.1 ^9.0 || ^10.0 || ^11.0 Apache-2.0
4.0.0 >=8.1 ^9.0 || ^10.0 Apache-2.0
3.0.0 >=7.3 ^8.0 || ^9.0 Apache-2.0