Giter VIP home page Giter VIP logo

uasparser's Introduction

UASparser — A User Agent String parser for PHP

Important: while the code in this package is functional, it's no longer any use because the data source at user-agent-string.info (now udger.com) it relied on is no longer available.

It may work with udger.com's commercial data sources, but that's not available to test with; I recommend you switch to a different system such as Mobile-Detect.

Build Status Latest Stable Version Latest Unstable Version

This is a parser and classifier for user agent strings presented by HTTP clients.

This code is based on the libraries by Jaroslav Mallat available from http://user-agent-string.info/

Licensed under the LGPL, see license.txt for details.

This version improved by Marcus Bointon:

Documentation

Release notes may be found in the changelog.

Generate PHPDocs like this:

phpdoc --directory UAS --target ./phpdoc --ignore Tests/ --sourcecode --force --title UASParser

uasparser's People

Contributors

synchro avatar mimmi20 avatar yarroslav avatar

Stargazers

 avatar Hlaing Tin Htun avatar Noah Halstead avatar Sascha Ahmann avatar Mark Holtz avatar  avatar Simon Schaufelberger avatar Luca Filosofi avatar Arkadiy avatar Jelle Witteveen avatar KT avatar Žarko Đurić avatar Poom avatar moee avatar Chris Noden avatar Stéphane Dion avatar Lucas Gonzalez avatar Michael Lambert avatar Libern avatar

Watchers

Luca Filosofi avatar  avatar James Cloos avatar  avatar

uasparser's Issues

spam

spam e-mail ?

No way to prevent cache from being updated during the Parse call

From time to time the UAS server disappears. This causes significant delays on page requests waiting for a cache update.

It should be possible to init the Parser class with a flag to prevent a cache update so the front-end based calls will only use cached data and a cron job or similar can repopulate the cache.

This can be somewhat achieved by initing the Parser class with an extremely long updateInterval, but if my cron job fails to update the uasdata file and leaves the updatestatus set to false then the frontend call will still attempt to update the cache.

Tagging for Composer

Thanks for the updates yesterday.

One final request, can you please add a tag for 0.53 so composer can grab the correct version without having to use dev-master.

When existing uasdata file is current cache.ini should be updated

On line 325 of Parser.ini the download of the cache file can be skipped if the current cache file is up to date. This code does not update the cache.ini so any subsequent request will also attempt to update the cache.

Prior to the return true on line 326, the cache.ini should be updated to reflect the update attempt.

autoload

Can you set up autoloading in composer.json?

Cache is updated on every request

A successful cache update logs a lastupdatestatus of "1" to the cache.ini file (line 364 of Parser.php).

When loading data the DownloadData routine is triggered if lastupdatestatus is not equal to "0" (line 277 of Parser.php).

This results in DownloadData always being called.

Autoloading the class with composer does not work

There has already been Issue #1 with autoloading, where the proposed fix was to add this to composer.json:

"autoload": {
    "psr-0": {
        "UAS": "UAS/"
    }
}

However, I think it still does not work the way it is intended by composer. Usually, all you have to do is to include vendor/autoload.php and then using the class (i.e. new \UAS\Parser()) should work automatically. However, if I do that, I will get a 'PHP Fatal error: Class 'UAS\Parser' not found' error.

I forked the repo and changed the "UAS": "UAS/" to "UAS": "" and it seems to work. You can have a look at the commit here: moee@2f4f8ba

The tests seem to run, but I am not sure if backwards compatibility is maintained. If you think it is ok, then I could add a pull request.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.