xandrkat / yii2-check-ishome
Simple Yii2 component to check isHome no w or not. Or by url.
Package info
github.com/xandrkat/yii2-check-ishome
Type:yii2-extension
pkg:composer/xandrkat/yii2-check-ishome
dev-master / 1.0.x-dev
2019-08-07 03:26 UTC
Requires
- yiisoft/yii2: ~2.0.0
This package is auto-updated.
Last update: 2026-03-07 18:38:16 UTC
README
Simple Yii2 component to check isHome no w or not. Or by url.
Installation
The preferred way to install this extension is through composer.
Either run
php composer.phar require --prefer-dist xandrkat/yii2-check-ishome "@dev"
or add
"xandrkat/yii2-check-ishome": "@dev"
to the require section of your composer.json file.
Usage
add to main.php backend/frontend/app to copmponents aray
return [ //.... 'components' => [ 'isHome' => [ 'class' => 'xandrkat\homepagecheker\isHome', ], ], ];
Then use any do you want) As Simple, currnet url: Return string 'home' or empty string
<?php var_dump((bool)Yii::$app->isHome) ?> //- 'home'/'' will be returned 'home'/'' ```php <?php use yii\helpers\Url; ?> <?php var_dump((Yii::$app->isHome->check(Url::to('any'))); ?> //- true/false will be returned bool(true/false)