sfWurflPlugin - 0.1.2

Samuel D. Smith <me@onesmallstepforsam.com>

You are currently browsing
the website for symfony 1

Visit the Symfony2 website


« Back to the Plugins Home

Signin


Forgot your password?
Create an account

Tools

Stats

advanced search
Information Readme Releases Changelog Contribute
Show source

sfWurfl Plugin

sfWurflPlugin is a plugin for the symfony Web PHP Framework. The plugin bridges the symfony framework and WURFL PHP API library and exposes all available, relevant device information to the developer through the sfWurflDevice class.

Installation

  • Install the plugin

    $ symfony plugin:install sfWurflPlugin
    
  • Add the sfWurflDeviceFilter to your filter chain

    # Insert your own filters here
     
    ...
     
    wurfl_device: { class: sfWurflDeviceFilter }
  • Change the default WURFL PHP API library directory and config file in your app.yml (optional)

    all:
      sf_wurfl:
        lib_dir:     /path/to/wurfl/lib
        config_file: /path/to/wurfl/config/file
  • Clear your cache

    $ symfony cc
    
  • Reload the WURFL PHP API cache (recommended)

    $ symfony wurfl:reload-cache
    

    N.B.: if you don't reload the WURFL PHP API cache you will suffer a massive performance hit as the WURFL Device Manager parses and caches the wurfl.xml file.

Using The sfWurflDevice Class

The sfWurflDevice class encapsulates the WURFL_Device class, which in turn exposes all available information about the device making the request.

To get the id of the WURFL record corresponding to the device use

sfWurflDevice::getInstance()->getId();

In all other eventualities use

sfWurflDevice()::getInstance()->getCapability($capability_name)

to get device information.

See WURFL for a list and detailed explanation of all capabilities recorded in the WURFL database.