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

Installs: 5 056

Dependents: 0

Suggesters: 0

Security: 0

Stars: 1

Watchers: 18

Forks: 0

Open Issues: 2

Type:cakephp-plugin

v0.1.1 2020-08-20 05:49 UTC

This package is auto-updated.

Last update: 2024-04-25 16:13:38 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 compare whitelist.
  • void checkOrFail(string $ip = null) - throws \Cake\Http\Exception\ForbiddenException when bad ip address.