diff --git a/composer.json b/composer.json index bf8709f..710e20d 100644 --- a/composer.json +++ b/composer.json @@ -21,9 +21,9 @@ "require": { "php": ">=8.1", "ext-json": "*", - "illuminate/cache": "^9.19|^10", - "illuminate/routing": "^9.19|^10", - "illuminate/support": "^9.42|^10", + "illuminate/cache": "^9.19|^10|^11", + "illuminate/routing": "^9.19|^10|^11", + "illuminate/support": "^9.42|^10|^11", "mobiledetect/mobiledetectlib": "~2.8", "ua-parser/uap-php": "~3.9" }, diff --git a/readme.md b/readme.md index 38329da..d09f161 100644 --- a/readme.md +++ b/readme.md @@ -46,6 +46,37 @@ The package uses the [auto registration feature](https://laravel.com/docs/5.8/pa The middleware needs to be registered with the Kernel to allow it to parse the request. +### Laravel 11 & newer + +Register the HTTP Stack Middleware for the web group in `bootstrap/app.php`: + +```php + ->withMiddleware(function (Middleware $middleware) { + // ... + $middleware->web(append: [ + // ... + \Spinen\BrowserFilter\Stack\Filter::class, + ]); + // ... + }) +``` + +Register the Route Middlewares in `bootstrap/app.php`: + +```php + ->withMiddleware(function (Middleware $middleware) { + // ... + $middleware->alias([ + // ... + 'browser.allow' => \Spinen\BrowserFilter\Route\AllowFilter::class, + 'browser.block' => \Spinen\BrowserFilter\Route\BlockFilter::class, + ]); + // ... + }) +``` + +### Before Laravel 11 + Register the HTTP Stack Middleware for the web group in `app/Http/Kernel.php`: ```php @@ -66,6 +97,8 @@ Register the Route Middlewares in `app/Http/Kernel.php`: 'browser.block' => \Spinen\BrowserFilter\Route\BlockFilter::class, ``` +### Page to show if blocked + Build a page with a named route to redirect blocked browsers to: ```php