tyrellsys / cakephp3-ip-filter
restrict access by ip address for CakePHP3
Installs: 5 801
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 17
Forks: 1
Open Issues: 1
Type:cakephp-plugin
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: 2025-03-12 08:19:33 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.