Looking to hire Laravel developers? Try LaraJobs
This package is not available.

laravel-multiregion maintained by tpetry

Description
Middleware to create multi-region applications with read-after-write consistency
Author
Last update
2026/11/05 10:12 (dev-main)
License
Downloads
2

Comments
comments powered by Disqus

Middleware to create error-free multi-region applications

Installation

You can install the package via Composer:

composer require tpetry/laravel-multiregion

Publishing the Configuration File

php artisan vendor:publish --tag="multiregion-config"

Usage

Testing that every route uses multi-region middleware

A forgotten multiRegionRead(), multiRegionWrite() or noMultiRegion() on a route can lead to stale data. An architecture test can catch them. Add the ExpectsRoutes trait to your tests in tests/Pest.php:

use Tpetry\MultiRegion\Pest\ExpectsRoutes;

pest()->extend(TestCase::class)
    ->use(ExpectsRoutes::class)
    ->in('Feature', 'Arch');

And create an architecture test, e.g. tests/Arch/MultiRegionTest.php:

arch()
    ->expectRoutes()
    ->toUseMultiRegionMiddleware()
    ->ignoring([
        '/up',
        '/storage/*',
        'crm.page.*',
    ]);

Routes can be ignored by their URI (starting with a slash) or their name. Both may contain wildcards. The test fails for the first route without one of the middleware:

Changelog

Please see CHANGELOG for more information on what has changed recently.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

License

Laravel Multi Region Databases is open-sourced software licensed under the MIT license.