Kirby3 Mobile Detect - get device information in PHP

I am creating posts for my plugins to make it easier to find them using the forum search and not just the docs search.

Static Class and Page Methods for using the popular and well tested Mobile Detect library.

$detect = $page->detect();
// https://github.com/serbanghita/Mobile-Detect/wiki/Code-examples
$detect->is('Chrome');

$isMobile = $page->isMobile();
// or
$isMobile = Bnomei\MobileDetect::instance()->isMobile();
$isTablet = $page->isTablet();

With Bnomei\MobileDetect::instance() you have access to all detections functions and can get more detailed information about used browser, phone model, …

1 Like