Skip to content

rob-bar/special_agent

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code
This branch is 3 commits behind mcmillan:master.

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 

Special Agent

Special Agent is a FuelPHP package which uses php-mobile-detect to determine whether a device is mobile or not - this is largely to negate the use of Browscap, which has proven to be entirely unreliable as of late.

What it does

This package does three things.

  • Firstly, it overwrites the default Agent::is_mobiledevice() method to use php-mobile-detect.
  • Secondly, it overrides the is_mobiledevice method:
    • Agent::is_mobile() - merely shorthand for Agent::is_mobiledevice()
  • Thirdly, added all the remaining methods from the class
    • Agent::is_tablet()
    • Agent::is_mobiledevice()
    • Agent::is_mobile()
    • Agent::is_tablet()
    • Agent::is_ios()
    • Agent::is_android_os()
    • Agent::is($value)
    • Agent::component_version($value)

Usage

Clone it into fuel/packages:

git clone --recursive git://github.com/rob-bar/special_agent fuel/packages/special_agent

After doing that, ensure you're always loading it in your config.php file, like so:

'always_load' => array(
	'packages' => array(
		'special_agent'
	)
)

And you're done. Easy as cheese.

About

A FuelPHP package which wraps php-mobile-detect for better mobile device detection.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • PHP 100.0%