fuelphp-storage / fuelphp

FuelPHP framework
http://fuelphp.com
MIT License
274 stars 57 forks source link

Create agent package #5

Open WanWizard opened 11 years ago

WanWizard commented 11 years ago

The functionality of the existing class can be converted as-is to non-static methods.

If probably need to be less dependent on the existence of the browscap file, since the availability seems not to be guaranteed these days.

WanWizard commented 11 years ago

Repository fuelphp/agent created.

dercoder commented 9 years ago

Will there be also some GeoIP support. For example to locate the country by IP? Or is this the wrong place to add such a function?

sagikazarmark commented 9 years ago

Not sure, functionality should be kept simple and straightforward. Also, agent is slow enough on its own.

WanWizard commented 9 years ago

There are some discussions on the v1 issue tracker to replace Agent with a third party package too.

In general, we as developers of an entire framework should never try to be better than someone who only has one specific package as focus. As long as it does the job, or it can be easily wrapped into something that does the job.

We may suggest something, or include it if the core code needs it. And we may provide an API for it through the Legacy package (when it comes to Agent for example).

sagikazarmark commented 9 years ago

My plan is to create adapters for multiple agent libraries. @kenjis provided us a great benchmark. Should we drop this package? (Isn't it needed for the session, UA based matching?)

WanWizard commented 9 years ago

I don't think a few adapters justify a separate package. Better put it into Foundation then.

Session uses the raw UA from the Input class, it doesn't need to lookup anything, it just matches (or not).

sagikazarmark commented 9 years ago

Then I suggest deprecating the agent package if we don't need it. Everyone can use which mostly fits to his/her needs.

WanWizard commented 9 years ago

If you mean this (the v2) package: yes, good idea.

sagikazarmark commented 9 years ago

Yeah, I mean it.

dercoder commented 9 years ago

I think it would be nice to have one seperated agent package with multiple adapters. So if the developer dont know any existing package he dont have to search. FuelPHP will recommend some existing one and if the developer dont like, he can still use his package he wants.

dercoder commented 9 years ago

CodeIgniter got his own Class which will only detect some basic informations. Thats also a nice feature to speed up site.

https://github.com/bcit-ci/CodeIgniter/blob/develop/application/config/user_agents.php https://github.com/bcit-ci/CodeIgniter/blob/21898a45f323bb74ef6e5ee8cf21c3397467665b/system/libraries/User_agent.php

sagikazarmark commented 9 years ago

I don't think we should have one if we don't need one. UA parsing is messy enough not to care about it.