PHPackages                             chronon/mobile\_detect - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. chronon/mobile\_detect

ActiveCakephp-plugin

chronon/mobile\_detect
======================

A CakePHP plugin component for identifying mobile devices using the Mobile\_Detect project.

1.1.2(11y ago)24246.5k—1.2%7[1 PRs](https://github.com/chronon/CakePHP-MobileDetectComponent-Plugin/pulls)1MITPHPPHP &gt;=5.3.0

Since Apr 22Pushed 6y ago3 watchersCompare

[ Source](https://github.com/chronon/CakePHP-MobileDetectComponent-Plugin)[ Packagist](https://packagist.org/packages/chronon/mobile_detect)[ Docs](https://github.com/chronon/CakePHP-MobileDetectComponent-Plugin)[ RSS](/packages/chronon-mobile-detect/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (2)Versions (4)Used By (1)

CakePHP Mobile-Detect Component
===============================

[](#cakephp-mobile-detect-component)

CakePHP's built-in CakeRequest object can easily determine if a request is from a mobile device:

```
$this->request->is('mobile');

```

However, sometimes an application needs finer control over what to serve certain devices, such as a mobile layout to smartphones and a desktop layout to tablets. The [MobileDetect](http://mobiledetect.net/)project is a "lightweight PHP class for detecting mobile devices". This component, packaged as a plugin, makes MobileDetect available in a CakePHP controller.

Compatibility:
--------------

[](#compatibility)

Tested with CakePHP 2.10.x, but should work fine with any CakePHP 2.x version.

**NOTE:** This plugin is not CakePHP 3.x compatible, but the `Mobile_Detect` lib is included with the CakePHP 3 [app skeleton](https://github.com/cakephp/app) and can be used and extended as needed making this plugin unnecessary.

- [cakephp/app#38](https://github.com/cakephp/app/pull/38)
- [cakephp/cakephp#3031](https://github.com/cakephp/cakephp/pull/3031)

Installation:
-------------

[](#installation)

**Using [Composer](http://getcomposer.org/)/[Packagist](https://packagist.org):**

In your project `composer.json` file:

```
{
	"require": {
		"chronon/mobile_detect": "*"
	},
	"config": {
        "vendor-dir": "Vendor"
    }
}

```

This will install the plugin into `Plugin/MobileDetect`, and install the Mobile\_Detect lib (from Packagist) into your `Vendor` directory.

In your app's `Config/bootstrap.php`, import composer's autoload file:

```
