Download the PHP package middlewares/firewall without Composer
On this page you can find all versions of the php package middlewares/firewall. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download middlewares/firewall
More information about middlewares/firewall
Files in middlewares/firewall
Package firewall
Short Description Middleware to provide IP filtering
License MIT
Homepage https://github.com/middlewares/firewall
Informations about the package firewall
middlewares/firewall
Middleware to provide IP filtering.
Requirements
- PHP >= 7.2
- A PSR-7 http library
- A PSR-15 middleware dispatcher
Installation
This package is installable and autoloadable via Composer as middlewares/firewall.
Example
Usage
The constructor accepts an array with the whitelist ips. See the ip formats allowed.
Optionally, you can provide a Psr\Http\Message\ResponseFactoryInterface
as the second argument to create the error response (403
). If it's not defined, Middleware\Utils\Factory will be used to detect it automatically.
blacklist
The blacklist ips. The ip format is the same than whitelist.
ipAttribute
By default uses the REMOTE_ADDR
server parameter to get the client ip. Use this option if you want to use a request attribute. Useful to combine with any ip detection middleware, for example client-ip:
Please see CONTRIBUTING for contributing details.
The MIT License (MIT). Please see LICENSE for more information.
All versions of firewall with dependencies
middlewares/utils Version ^3.0
psr/http-server-middleware Version ^1.0
mlocati/ip-lib Version ^1.18