| 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
17 Comments
comments.show.hideFeb 12, 2008
Pavel Chipiga
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.
Mar 07, 2008
Vincent de Lau
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?
Mar 07, 2008
Roman
This is useful database with mobile user agents http://wurflpro.com/
May 09, 2008
Andrea Turso
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!
May 14, 2008
Wil Sinclair
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
Jun 10, 2008
Christer Edvartsen
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.
Jun 11, 2008
Matthew Ratzloff
Argh. I already wrote a really awesome implementation of this, but it's proprietary.
I can give you some tips, however:
Your proposal, as it currently stands, doesn't seem that useful. Capabilities are what users want to know.
Jun 12, 2008
Christer Edvartsen
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.
Aug 11, 2008
Juan Felipe Alvarez Saldarriaga
Is this proposal dead ? hope not :|
Aug 23, 2008
Marek
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.
Oct 12, 2008
Ben Scholzen
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
Oct 13, 2008
Goran Juric
I don't agree. Parsing .ini files is quite slow and requires another dependency that is not needed (and also needs to be updated).
Jan 27, 2009
Muhammad Hussein Fattahizadeh
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.
Mar 23, 2009
Ramses Paiva
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
Aug 16, 2010
Christer Edvartsen
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?
Oct 15, 2010
Matthew Weier O'Phinney
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.
Feb 06, 2011
Dolf Schimmel (Freeaqingme)
Archiving this proposal, feel free to recover it when you want to work on it again. For more details see this email.