Download the PHP package superbig/craft3-mobiledetect without Composer

On this page you can find all versions of the php package superbig/craft3-mobiledetect. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package craft3-mobiledetect

MobileDetect plugin for Craft CMS 5

Use Mobile_Detect for detecting mobile devices (including tablets).

Requirements

Installation

  1. Open your terminal and go to your Craft project:

    cd /path/to/project
  2. Tell Composer to load the plugin:

    composer require superbig/craft3-mobiledetect
  3. In the Control Panel, go to Settings → Plugins and click the "Install" button for MobileDetect.

Overview

A wrapper for the Mobile_Detect library (v4) by @serbanghita.

Usage

Twig

PHP

Methods

Device detection

Method Description
isMobile Returns true for any mobile device (including tablets)
isTablet Returns true for tablets only
isPhone Returns true for phones only (mobile but not tablet)

OS & browser detection (magic methods)

Any is* call is forwarded to the library's rule matching. These work in both Twig and PHP:

Method Description
isiOS iOS devices
isAndroidOS Android devices
isBlackBerryOS BlackBerry devices
isWindowsMobileOS Windows Mobile devices
isWindowsPhoneOS Windows Phone devices
isChrome Chrome browser
isSafari Safari browser
isFirefox Firefox browser
is* Any rule the library supports — see Mobile_Detect docs

Rule-based detection

Method Description
is(key) Test any rule by name, e.g. is('iOS'), is('AndroidOS'), is('Chrome')
match(pattern) Test using a regular expression against the user agent
version(component) Get the version of a component, e.g. version('Android')

Utility methods

Method Description
getVersion Returns the Mobile_Detect library version
getUserAgent Get the current user agent string

Upgrading from v2 (Craft 4)

Breaking changes

What still works

All is* magic methods (isiOS, isAndroidOS, isChrome, etc.) continue to work in Twig templates — no changes needed.

PHP service access

The static $plugin property has been removed. Use getInstance():

Brought to you by Superbig


All versions of craft3-mobiledetect with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2.0
craftcms/cms Version ^5.5
mobiledetect/mobiledetectlib Version ^4.8
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package superbig/craft3-mobiledetect contains the following files

Loading the files please wait ...