Download the PHP package kwenziwa/devicedetector without Composer
On this page you can find all versions of the php package kwenziwa/devicedetector. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download kwenziwa/devicedetector
More information about kwenziwa/devicedetector
Files in kwenziwa/devicedetector
Package devicedetector
Short Description Device Detector is a versatile, easy-to-use package for project that provides seamless device and operating system detection. Leveraging the robustness of mobiledetect/mobiledetectlib, this package allows developers to quickly identify whether a user is accessing their application from a mobile device, tablet, or desktop and determine the operating system, such as iOS or Android.
License MIT
Informations about the package devicedetector
Device Detector
Device Detector is a convenient package for applications, offering easy detection of user devices and their operating systems. Utilizing the mobiledetect/mobiledetectlib
library, this package enables applications to quickly identify device types (mobile, tablet, desktop) and operating systems (iOS, Android, etc.), enhancing the user experience and providing valuable insights.
Features
- Detect whether the user's device is a mobile, tablet, or desktop
- Identify the operating system of the user's device (iOS, Android, etc.)
- Lightweight and easy to integrate into any project
Installation
Install the package via composer:
Usage
After installation, you can use the DeviceDetector in your application as follows:
Methods
isMobile()
Determines if the user's device is a mobile phone.
isTablet()
Determines if the user's device is a tablet.
isDesktop()
Determines if the user's device is a desktop. This is typically the default if the device is neither a mobile nor a tablet.
isIOS()
Checks if the user's device is running iOS.
isAndroidOS()
Checks if the user's device is running Android OS.
getDeviceType()
Returns the type of the user's device as a string ('mobile', 'tablet', or 'desktop').
getOSType()
Returns the operating system of the user's device as a string (e.g., 'iOS', 'Android', 'Windows Mobile', 'BlackBerry', 'Symbian', or 'Unknown').
getBrowser()
Returns the the browser name system of the user's device as a string.
Run the Tests
Run the tests using the PHPUnit command:
This command will execute all tests in your tests directory. The above tests are basic and might not effectively cover all scenarios since the actual device type and OS will depend on the environment where the tests are run. In a more comprehensive test suite, you would mock the MobileDetect class to simulate different devices and operating systems. This would allow you to test all branches of your code.
Contributing
Contributions are welcome and will be fully credited. We accept contributions via Pull Requests on Github.
License
The Device Detector is open-sourced software licensed under the MIT license.