Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/pH-7/PhoneDetector
📱 Detect the user mobile phone (Android or iOS) based on their device's OS
https://github.com/pH-7/PhoneDetector
detect-phone detector device-detector lightweight-library mobile phone phone-detector phone-os-detector php
Last synced: 3 months ago
JSON representation
📱 Detect the user mobile phone (Android or iOS) based on their device's OS
- Host: GitHub
- URL: https://github.com/pH-7/PhoneDetector
- Owner: pH-7
- License: mit
- Created: 2019-07-17T21:13:03.000Z (over 5 years ago)
- Default Branch: main
- Last Pushed: 2022-11-25T11:04:32.000Z (about 2 years ago)
- Last Synced: 2024-10-30T16:48:37.734Z (3 months ago)
- Topics: detect-phone, detector, device-detector, lightweight-library, mobile, phone, phone-detector, phone-os-detector, php
- Language: PHP
- Homepage: https://github.com/pH-7/PhoneDetector
- Size: 27.3 KB
- Stars: 9
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# 📱 PhoneDetector
**Lightweight PHP 7.2 library that detects users' mobile phone based on the device OS.**
## 📓 Installation (with Composer)
```bash
composer require ph-7/phonedetector
```## 🎮 Usage
Below are two simple examples of what you can do with **PhoneDetector** library.
### Example 1
```php
use PierreHenry\PhoneDetector\PhoneDetector;$phoneDetector = new PhoneDetector();
if ($phoneDetector->isAndroid()) {
echo 'Your mobile phone is Android!';
}if ($phoneDetector->isIos()) {
echo 'Your mobile phone runs on iOS';
}
```### Example 2
```php
isAndroid()) {
$url = 'https://play.google.com/store/apps/details?id=com.lifyzer';
} elseif($phoneDetector->isIos()) {
$url = 'https://apps.apple.com/app/longer-life-lifyzer-food-scan/id1466196809';
} else {
$url = 'https://DEFAULT-URL.example';
}header('Location: ' . $url);
```## âš™ Server Requirement
- [PHP 7.2](https://php.net/releases/7_2_0.php) or higher.
## 🚀 Author
[![Pierre-Henry Soria](https://avatars0.githubusercontent.com/u/1325411?s=200)](https://pierrehenry.be "My personal website :-)")
[![@phenrysay][twitter-image]][twitter-url]
**[Pierre-Henry Soria][author-url]**, a Passionate, Zen&Cool Belgian Software Engineer :belgium: :chocolate_bar:
## 😄 Used By...
I initially created PhoneDetector to redirect users to the correct app's store for *https://get.lifyzer.com* depending on the mobile device.
**[https://github.com/Lifyzer/get.lifyzer.com](https://github.com/Lifyzer/get.lifyzer.com)**
## âš– License
**PhoneDetector** library is generously distributed under [MIT License][license-url].
[author-url]: https://pierrehenry.be
[license-url]: https://opensource.org/licenses/MIT
[twitter-image]: https://img.shields.io/twitter/url/https/shields.io.svg?style=social
[twitter-url]: https://twitter.com/phenrysay