xandrkat/yii2-check-ishome

Simple Yii2 component to check isHome no w or not. Or by url.

Installs: 0

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 0

Forks: 0

Open Issues: 0

Type:yii2-extension

dev-master / 1.0.x-dev 2019-08-07 03:26 UTC

This package is auto-updated.

Last update: 2020-04-07 05:04:01 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)