Home
Docs
GitHub
Pricing
Blog
Log In

Run Sandworm Audit for your App

Get started
Generated on May 18, 2024 via composer

mobiledetect/mobiledetectlib 4.8.04

Mobile_Detect is a lightweight PHP class for detecting mobile devices. It uses the User-Agent string combined with specific HTTP headers to detect the mobile environment.
Package summary
Share
0
issues
1
license
2
MIT
Package created
20 Nov 2012
Version published
28 Oct 2023
Maintainers
1
Total deps
2
Direct deps
1
License
MIT

Issues

0
This package has no issues

Licenses

MIT License

Permissive
OSI Approved
This is a human-readable summary of (and not a substitute for) the license. Disclaimer.
Can
commercial-use
modify
distribute
sublicense
private-use
Cannot
hold-liable
Must
include-copyright
include-license
2 Packages, Including:
mobiledetect/mobiledetectlib@4.8.04
psr/simple-cache@3.0.0
Disclaimer

This deed highlights only some of the key features and terms of the actual license. It is not a license and has no legal value. You should carefully review all of the terms and conditions of the actual license before using the licensed material.

Sandworm is not a law firm and does not provide legal services. Distributing, displaying, or linking to this deed or the license that it summarizes does not create a lawyer-client or any other relationship.

Direct Dependencies

1
All Dependencies CSV
β“˜ This is a list of mobiledetect/mobiledetectlib 's direct dependencies. Data on all dependencies, including transitive ones, is available via CSV download.
NameVersionSizeLicenseTypeVulnerabilities
psr/simple-cache3.0.04.48 kBMIT
prod

Visualizations

Frequently Asked Questions

What does mobiledetect/mobiledetectlib do?

Mobile Detect, also known as mobiledetect/mobiledetectlib, is a lightweight PHP class that performs mobile device detection. It uses the User-Agent string along with specific HTTP headers to identify the mobile environment. This library provides a server-side detection mechanism that assists in distinguishing between a mobile phone and a tablet through the use of regular expressions. The class ensures detection accuracy and relevance by running tests to check for detection conflicts. It provides crucial support in implementing a responsive web design strategy and can be used along with CSS3 media queries and other client-side feature detection methods.

How do you use mobiledetect/mobiledetectlib?

Usage of mobiledetect/mobiledetectlib is straightforward. It starts with the installation via composer by using the command composer require mobiledetect/mobiledetectlib. To include the dependency in your PHP project, you should add "mobiledetect/mobiledetectlib": "^4.8" under the require section in the composer.json file. To detect a mobile device, you can instantiate the MobileDetect class and set the user agent string. The isMobile() and isTablet() methods can be used to determine the device type.

Here's an illustrative example:

// Include composer's autoloader
require __DIR__ . '/vendor/autoload.php';

use Detection\MobileDetect;

// Instantiate the class
$detect = new MobileDetect;

// Set the user agent string from HTTP headers
$detect->setUserAgent('Mozilla/5.0 (iPad; CPU OS 14_7 like Mac OS X) ...');

// Check for "mobile"
$deviceType = ($detect->isMobile() ? ($detect->isTablet() ? 'tablet' : 'phone') : 'computer');

In this example, the $deviceType variable will contain the type of the detected device.

Where are the mobiledetect/mobiledetectlib docs?

You can find the comprehensive documentation for mobiledetect/mobiledetectlib on the project's GitHub repository. The readme file contains detailed explanations about its installation, usage, features, and potential performance. Furthermore, it provides the structure of the project along with test execution details. You can contribute to the project, access several modules, plugins, ports, and check out its considerable history.