Skip to end of metadata
Go to start of metadata
Under Construction
This proposal is under construction and is not ready for review.

Zend Framework: Zend_UserAgent Component Proposal

Proposed Component Name Zend_UserAgent
Developer Notes http://framework.zend.com/wiki/display/ZFDEV/Zend_UserAgent
Proposers Christer Edvartsen
Revision 0.1 - 23 January 2008: Created initial proposal page (wiki revision: 10)

Table of Contents

1. Overview

Zend_UserAgent will let the user gain more knowledge of the user agent. Zend_UserAgent can inform you if the user is using a mobile phone, a regular browser, or if it is some other kind of device.

2. References

3. Component Requirements, Constraints, and Acceptance Criteria

  • This component will figure out the type of the user agent; browser, mobile, rss reader, robot and so on

4. Dependencies on Other Framework Components

  • Zend_Exception

5. Theory of Operation

6. Milestones / Tasks

7. Class Index

  • Zend_UserAgent
  • Zend_UserAgent_Exception

8. Use Cases

9. Class Skeletons

Labels:
None
Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.
  1. Feb 12, 2008

    Good idea!
    It is also will be useful try to detect browser/robot type (IE, Opera, Mozilla, etc) and version, xHTML, Javascript support by UA string.

  2. Mar 07, 2008

    Also noteworthy: http://browsers.garykeith.com/

    Seeing Pavel's comment, I'd expect that people want to add more functionality (vendor, version, accept* headers etcetera). Maybe use a plug-in architecture to allow other information to be gathered and queried?

  3. Mar 07, 2008

    This is useful database with mobile user agents http://wurflpro.com/

  4. May 09, 2008

    Hi, that's my first post over here, so I'm sorry if I got something wrong ^^.
    Why using class constants for storing the type of the user agent?
    Altough it is a good idea, what if a different useragents are available?
    Does the developer should work with the constant TYPE_UNKNOWN? And then what if the past unknown useragent is added to the recognized type of user agents by this class?
    Should the developer rewrite her code?

    I think in this case using a object to identify the user agent could be better because of further modifications to the class are not needed, instead, she can create new classes that implements a specific interface to add new types of user agents or to customize the recognized user agents.
    Something that behaves like the Null Object Pattern or Strategy pattern should do the job very well.
    For instance:

    In that way also informations about the user agent can be provided!
    I know a library that permits to retrieve user agents information, give it a look: http://garetjax.info/projects/browscap/

    I hope my comment can be helpful!

  5. May 14, 2008

    Christer, it appears that the community is already providing feedback on this proposal. Is it ready for review? If so, please reparent it and announce on the mailing list.

    Thanks.
    ,Wil

    1. Jun 10, 2008

      It's not yet ready for review. I have had too much on my hands lately but will start doing some more work on the component soon. I will reparent it when it's ready.

  6. Jun 11, 2008

    Argh. I already wrote a really awesome implementation of this, but it's proprietary. I can give you some tips, however:

    • Pluggable data sources
    • Knowing specifics about the browser on the server side is not terribly useful; look at DeviceAtlas and WURFL
    • You can't predict every bit of information a user might want to get if they wish to create custom data sources, so your interfaces must be very generalized

    Your proposal, as it currently stands, doesn't seem that useful. Capabilities are what users want to know.

    1. Jun 12, 2008

      The proposal is pretty outdated as I have been doing some restructuring of the component but I haven't had enough time on my hands to finish things up.

  7. Aug 11, 2008

    Is this proposal dead ? hope not :|

  8. Aug 23, 2008

    I think this component could be very useful. For example Zend_Session. Cookies are send based on old 'Expires' method - if session time is set to low value and client and server are in different timezones, cookie could expire before it's date. Detecting UA allows You to use 'Max-Age' for modern browsers. You also need to remember to secure this string as it could be everything.

  9. Oct 12, 2008

    I suggest to use browscap.ini to gather all available information. See:

    http://www.php.net/manual/en/function.get-browser.php http://browsers.garykeith.com/downloads.asp

    1. Oct 13, 2008

      I don't agree. Parsing .ini files is quite slow and requires another dependency that is not needed (and also needs to be updated).

  10. Jan 27, 2009

    use user-agents.org for distribute the type of user agent and more features.
    use the standard xml file for data base of user agent.
    but join with Zend_Cache for increase the operation performance.

    thank and good luck.

  11. Mar 23, 2009

    Probably, it can be useful, but I believe it belongs to the Request object.
    So, perhaps placing it as Zend_Controller_Request_UserAgent would be a better idea.
    Or, even better, you could make it as a plugin, injecting this information on the request object.

    Regards

  12. Aug 16, 2010

    There is an xml file over at http://user-agents.org/ that seems to be pretty up to date. Would it be possible to add this file to Zend Framework and parse it when using the user agent component? There should of course be easy options for caching this information using for instance Zend_Cache as mentioned above.

    The xml is about 700KB so it's quite heavy... I guess compiling a separate list internal to Zend Framework is not the way to go. The xml file is also quite fine-grained, and I don't really think we need all that information.

    Any ideas?

    1. Oct 15, 2010

      Honestly, WURFL is typically considered the standard.

      I would recommend that you look at the Zend_Browser proposal, and work with the proposal authors there, as they have a very robust approach to determining user agent capabilities. The user-agents.org database might be a good additional adapter to add to that proposal.

  13. Feb 06, 2011

    Archiving this proposal, feel free to recover it when you want to work on it again. For more details see this email.