apollo11 / yii2-behaviors
Collection of global helper behaviors for Yii2 Framework
Installs: 14
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 3
Forks: 0
Open Issues: 0
pkg:composer/apollo11/yii2-behaviors
Requires
- composer/composer: >=1.6.3
This package is not auto-updated.
Last update: 2025-09-28 11:03:44 UTC
README
Global Page Cache Behavior
Following behavior gives you the ability to enable Yii2 PageCache globally from config. Copy the following config to your respective config file.
... 'as globalCache' => [ 'class' => '\apollo11\behaviors\behaviors\GlobalPageCacheBehavior', 'rules' => [ [ 'controller' => 'about', 'actions' => ['index', 'main'], 'except' => ['view'], 'duration' => 70, 'variations' => [ \apollo11\behaviors\behaviors\GlobalPageCacheBehavior::VARIATION_BY_LANGUAGE, \apollo11\behaviors\behaviors\GlobalPageCacheBehavior::VARIATION_BY_URL, ], ] ] ], ...
Param | Value |
Controller | String : Controller ID : Required |
Duration | Integer : Cache duration in seconds : Optional : Default - 60 seconds |
Actions | Array : Action IDs to cache: Required : '*' - for all actions |
Except | Array : Action IDs to skip cache on : Optional |
Variations | Array : Strings for respective vartiations of caching : Optional |