https://github.com/flextype-components/agent
Agent component provides a simple way to detect the kind of device that made the request.
https://github.com/flextype-components/agent
agent component flextype flextype-component php user-agent
Last synced: 5 months ago
JSON representation
Agent component provides a simple way to detect the kind of device that made the request.
- Host: GitHub
- URL: https://github.com/flextype-components/agent
- Owner: flextype-components
- License: mit
- Created: 2015-10-04T22:49:18.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2018-04-12T11:49:52.000Z (about 8 years ago)
- Last Synced: 2024-12-09T22:58:17.646Z (over 1 year ago)
- Topics: agent, component, flextype, flextype-component, php, user-agent
- Language: PHP
- Homepage:
- Size: 6.84 KB
- Stars: 0
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# Agent Component

[](https://github.com/flextype-components/agent/blob/master/LICENSE)
Agent component provides a simple way to detect the kind of device that made the request.
### Installation
```
composer require flextype-components/agent
```
### Usage
```php
use Flextype\Component\Agent\Agent;
```
Returns true if the user agent that made the request is identified as a mobile device.
```php
if (Agent::isMobile()) {
// Do something...
}
```
Returns true if the user agent that made the request is identified as a robot/crawler.
```php
if (Agent::isRobot()) {
// Do something...
}
```
Returns TRUE if the string you're looking for exists in the user agent string and FALSE if not.
```php
if (Agent::is('iphone')) {
// Do something...
}
if (Agent::is(array('iphone', 'ipod'))) {
// Do something...
}
```
## License
See [LICENSE](https://github.com/flextype-components/agent/blob/master/LICENSE)