Skip to content
PHP Ecosystem
Explore

AccessGuard

API reference › Debug › service › AccessGuard

classyii\debug\service\AccessGuard
Sourcesrc/service/AccessGuard.php

Decides whether a request may reach the debugger.

The IP and host allowlists are evaluated first, so a denial by address never runs the application callback.

PropertyTypeDescriptionDefined by
$module protected readonly constructoryii\debug\ModuleDebug module read for the access configuration at call time.AccessGuard
MethodDescriptionDefined by
__construct()Binds access checks to the debug module.AccessGuard
allows()Returns whether the request is allowed to reach the debugger.AccessGuard
public function __construct(yii\debug\Module $module)

Binds access checks to the debug module.

Parameters

ParameterTypeDescription
$moduleyii\debug\ModuleDebug module read for the access configuration at call time.
public function allows(string $ip, yii\base\Action|null $action = null): bool

Returns whether the request is allowed to reach the debugger.

Checks Module::$allowedIPs and Module::$allowedHosts, then the optional Module::$checkAccessCallback, which grants access only by returning true. A denial is reported through Yii::warning() unless the matching disable*RestrictionWarning flag is set.

Parameters

ParameterTypeDescription
$ipstringRequesting IP address, or '' when the request carries none.
$actionyii\base\Action|nullAction being dispatched, or null outside an action context.

Returns

bool: true when the request may reach the debugger; false otherwise.