tyrellsys / cakephp3-ip-filter
There is no license information available for the latest version (v0.1.1) of this package.
restrict access by ip address for CakePHP3
Package info
github.com/tyrellsys/cakephp3-ip-filter
Type:cakephp-plugin
pkg:composer/tyrellsys/cakephp3-ip-filter
v0.1.1
2020-08-20 05:49 UTC
Requires
- php: >=5.6
- cakephp/cakephp: ~3.6
- wikimedia/ip-set: ^2.1
Requires (Dev)
- phpunit/phpunit: ^5.7|^6.0
This package is auto-updated.
Last update: 2026-02-17 09:00:23 UTC
README
restrict access by ip address for CakePHP3 Component
Installation
You can install this plugin into your CakePHP application using composer.
The recommended way to install composer packages is:
composer require tyrellsys/cakephp3-ip-filter
Configuration
Controller::initialize
...
public function initialize($event)
{
....
$this->loadComponent('Tyrellsys/CakePHP3IpFilter.IpFilter', [
'trustProxy' => true,
'whitelist' => '192.168.0.0/24' // array OR comma separate value
]);
...
Method
bool check(string $ip = null)- returns comparewhitelist.void checkOrFail(string $ip = null)- throws \Cake\Http\Exception\ForbiddenException when bad ip address.