Comments (11)
Hi, yes, moving away from php.ini browscap is a priority for me right now. I already have sped up GaretJax browscap, so it can fit my needs, and I'm going to migrate UserAgentInfo to use it in next two weeks (perhaps earlier, but I cannot guarantee that).
What about composer? Are there any substantial benefits of using it? Right now all you need to do is to put one require_once in the code and then you use the static class from anywhere in your code, so there isn't much need for autoloading here. Or could it perhaps help with using a cache with UserAgentInfo?
If you think it may be a good idea to use composer, I'm gonna look into it, but I don't like the idea of adding more bloat to the class if the benefit is not substantial.
from useragentinfo.
Moved request for browscap without php.ini to #5
This topic changed to a discussion about composer.
from useragentinfo.
Adding composer doesn't increase bloat. Composer does the autoloading for you if you follow PSR-0 namespacing. Otherwise a simple classmap is possible. It makes it easier to manage versions of releases.
from useragentinfo.
A programmartic conversion to json might be better.
from useragentinfo.
UserAgentInfo won't have any dependencies once browscap is migrated to phpbrowscap. It also doesn't require autoloading, it takes care of including its files. So the only reason to use composer would be for the updates.
I'm not against making it a composer package, but only if it can install updates from git, and if it can be made optional without forcing PHP 5.3+
requirement on the whole program.
I will have to test it and see if that can be achieved and if it will work well. If that will be the case then I will add composer.
That's going to have to wait until after the next release, because switching from get_browser()
to phpbrowscap
is a priority.
Btw. what do you mean by "A programmartic conversion to json might be better." ? Are you referring to the browscap.ini
source file?
from useragentinfo.
Composer can do that fine. It can install from git, but I prefer using tagged releases instead of branches. Yep I would prefer Json mainly because of multilanguage support. I may need to use other programming languages.
from useragentinfo.
I'm not going to use JSON as a source file for any of the parsers. PHP array source file is the way to go, performance wise.
Loading large data structures into PHP memory takes a lot of time. So, when you decode JSON into array of PHP objects, or unserialize array of arrays - it takes time. This time becomes more and more significant the larger the thing you have to load into memory is.
However, when you use opcache
on production servers, and that something you should definitely be doing, the PHP files you're using become already preloaded into the memory. That doesn't affect json source files behaviour, but when you use a php file with an array as a source for the data and use require
to load it, the time it previously took to load all that data drops almost to zero.
You can see time differences even for fast classes like ua-parser
- #7 (comment)
But the difference for phpbrowscap
between loading from PHP file (as it's doing now) and JSON file is huuuuge.
So, as I take performance as priority in my projects, I will only use PHP files as the source data files.
from useragentinfo.
Migration from php.ini based get_browser()
to phpbrowscap
project is now completed.
from useragentinfo.
+1 for making it a composer package
from useragentinfo.
I will test the composer this weekend.
from useragentinfo.
It'll also manage your dependencies so you don't need to include the 3rd party libs.
from useragentinfo.
Related Issues (18)
- Fatal error: Class 'sfTimerManager' not found in \myUAITimerAdapter.class.php on line 19 HOT 4
- Cache constantly regenerates because of different browscap versions... HOT 2
- Add information about IE compatibility mode.
- Migrate browscap from php.ini solution to 100% PHP solution HOT 2
- Update tests for bulk / nonbulk / opcache tests. HOT 2
- Leverage opcache for uaparser. HOT 2
- Restore is_banned property for browscap source parser HOT 2
- Important user agent is not fully overriden. HOT 1
- Make bot matches less specific / more specific.
- Add rendering engine information.
- Add more cache wrapper classes. HOT 1
- Profile parsing and including speed with xhprof
- Add a website to check user agent using UserAgentInfo. HOT 2
- Browser and device icons
- How to update HOT 4
- Project being maintained? HOT 2
- get_browser comparison at README
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from useragentinfo.