alikdex/yii2-crawler-detect

Yii2 extension for CrawlerDetect library

Installs: 17 970

Dependents: 0

Suggesters: 0

Security: 0

Stars: 13

Watchers: 1

Forks: 4

Open Issues: 0

Type:yii2-extension

1.0 2016-08-03 12:10 UTC

This package is auto-updated.

Last update: 2024-04-17 09:56:32 UTC


README

Yii2 extension for CrawlerDetect library.

To use it just require this extension in your composer.json file:

"alikdex/yii2-crawler-detect": "1.0",

And then add it to your components configuration in Yii2:

'bootstrap' => ['crawlerdetect'],
'components' => [
	'crawlerdetect' => [
		'class' => 'alikdex\crawlerdetect\CrawlerDetect',
		'setParams' => true, // optional, bootstrap initialize requred
	],
]

Some basic detections are available in Yii's params:

var_dump(Yii::$app->params['isCrawler']);

// bool(false)

You can also use it from anywhere in your code, calling Crawler-Detect's API:

\Yii::$app->crawlerdetect->isCrawler();

/*Check all available methods here: https://github.com/JayBizzle/Crawler-Detect */