Skip to content

Commit fa990c5

Browse files
committed
Document new way to register middleware
1 parent 837d70e commit fa990c5

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

readme.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,37 @@ The package uses the [auto registration feature](https://laravel.com/docs/5.8/pa
4646

4747
The middleware needs to be registered with the Kernel to allow it to parse the request.
4848

49+
### Laravel 11 & newer
50+
51+
Register the HTTP Stack Middleware for the web group in `bootstrap/app.php`:
52+
53+
```php
54+
->withMiddleware(function (Middleware $middleware) {
55+
// ...
56+
$middleware->web(append: [
57+
// ...
58+
\Spinen\BrowserFilter\Stack\Filter::class,
59+
]);
60+
// ...
61+
})
62+
```
63+
64+
Register the Route Middlewares in `bootstrap/app.php`:
65+
66+
```php
67+
->withMiddleware(function (Middleware $middleware) {
68+
// ...
69+
$middleware->alias([
70+
// ...
71+
'browser.allow' => \Spinen\BrowserFilter\Route\AllowFilter::class,
72+
'browser.block' => \Spinen\BrowserFilter\Route\BlockFilter::class,
73+
]);
74+
// ...
75+
})
76+
```
77+
78+
### Before Laravel 11
79+
4980
Register the HTTP Stack Middleware for the web group in `app/Http/Kernel.php`:
5081

5182
```php
@@ -66,6 +97,8 @@ Register the Route Middlewares in `app/Http/Kernel.php`:
6697
'browser.block' => \Spinen\BrowserFilter\Route\BlockFilter::class,
6798
```
6899

100+
### Page to show if blocked
101+
69102
Build a page with a named route to redirect blocked browsers to:
70103

71104
```php

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy