Labels
| 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: 9) |
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
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?
This is useful database with mobile user agents http://wurflpro.com/
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!
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
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.
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.
ZF Home Page
Code Browser
Wiki Dashboard
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.