bigdropinc / yii2-ajax-access-rule
Ajax access rule for yii2 access filter
Package info
github.com/bigdropinc/yii2-ajax-access-rule
Type:yii2-extension
pkg:composer/bigdropinc/yii2-ajax-access-rule
1.0.0
2017-04-10 14:04 UTC
Requires
- yiisoft/yii2: *
This package is not auto-updated.
Last update: 2026-03-07 02:54:40 UTC
README
Ajax access rule for yii2 access filter
Installation
The preferred way to install this extension is through composer.
Either run
php composer.phar require --prefer-dist bigdropinc/yii2-ajax-access-rule "*"
or add
bigdropinc/yii2-ajax-access-rule
to the require section of your composer.json file.
Usage
For AccessControl rules use AjaxRule::className()
'access' => [
'class' => AccessControl::className(),
'rules' => [
[
'class' => AjaxRule::className(),
'actions' => ['some-action'],
'verbs' => ['POST'],
'allow' => true #this will allow only ajax requests for specified action
],
[
'class' => AjaxRule::className(),
'actions' => ['another-action'],
'allow' => false #this will allow only non-ajax request for specified action
],
]
]