tequilarapido/restrict-access

1.0.4 2020-03-03 13:14 UTC

This package is auto-updated.

Last update: 2024-11-14 08:20:26 UTC


README

Latest Version on Packagist Software License StyleCI Quality Score

Installation

You can install the package using composer

$ composer require tequilarapido/restrict-access

Usage

  • Add service provider
Tequilarapido\RestrictAccess\ServiceProvider::class,
  • Add middlewares to kernel
protected $routeMiddleware = [
        'restrict_access_by_ip' => RestrictAccessByIp::class,
        'restrict_access_by_basic_auth' => RestrictAccessByBasicAuthentication::class,
    ];
  • Add middleware to routes on witch you need to restrict access

  • Env file

RESTRICT_ACCESS_BY_BASIC_AUTH_ENABLED=true
RESTRICT_ACCESS_BY_BASIC_AUTH_usename=username
RESTRICT_ACCESS_BY_BASIC_AUTH_password=password

RESTRICT_ACCESS_BY_IP_ENABLED=false
RESTRICT_ACCESS_BY_IP_ENABLED_EXCEPT=a,b,c

License

The MIT License (MIT). Please see License File for more information.