Changed name of IpBlockAccess to IpRestrictAccess & updated documentation.

This commit is contained in:
Simon Sessingø
2021-03-30 20:44:40 +02:00
parent 57047d23ea
commit 50b7129cab
4 changed files with 16 additions and 11 deletions
+9 -4
View File
@@ -1373,16 +1373,19 @@ This behavior can be easily disabled by setting `SimpleRouter::enableMultiRouteR
## Restrict access to IP
You can white- and blacklist access to IP's using the build in `IpBlockAccess` middleware.
You can white- and blacklist access to IP's using the build in `IpRestrictAccess` middleware.
Create your own Middleware and extend the `IpBlockAccess` class.
Create your own custom Middleware and extend the `IpRestrictAccess` class.
The `IpRestrictAccess` class contains two properties `ipBlacklist` and `ipWhitelist` that can be added
to your middleware to change which IP's has blocked or allowed access.
You can use `*` to restrict access to a range of ips.
```php
use \Pecee\Http\Middleware\IpBlockAccess;
use \Pecee\Http\Middleware\IpRestrictAccess;
class IpBlockMiddleware extends IpBlockAccess {
class IpBlockerMiddleware extends IpRestrictAccess {
protected $ipBlacklist = [
'5.5.5.5',
@@ -1396,6 +1399,8 @@ class IpBlockMiddleware extends IpBlockAccess {
}
```
You can the middleware to multiple routes by adding your [middleware to a groups](#middleware).
## Url rewriting
### Changing current route