{"id":19388892,"url":"https://github.com/james2doyle/pico_useragent","last_synced_at":"2026-05-16T15:02:37.103Z","repository":{"id":10630546,"uuid":"12854228","full_name":"james2doyle/pico_useragent","owner":"james2doyle","description":"Parse the user agent string of the current visitor and expose an array of values to use in your templates","archived":false,"fork":false,"pushed_at":"2014-12-30T18:53:06.000Z","size":125,"stargazers_count":4,"open_issues_count":0,"forks_count":1,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-03-03T20:02:00.823Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/james2doyle.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-09-15T23:15:10.000Z","updated_at":"2022-10-29T17:55:17.000Z","dependencies_parsed_at":"2022-09-18T07:33:10.725Z","dependency_job_id":null,"html_url":"https://github.com/james2doyle/pico_useragent","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/james2doyle/pico_useragent","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/james2doyle%2Fpico_useragent","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/james2doyle%2Fpico_useragent/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/james2doyle%2Fpico_useragent/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/james2doyle%2Fpico_useragent/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/james2doyle","download_url":"https://codeload.github.com/james2doyle/pico_useragent/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/james2doyle%2Fpico_useragent/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33107564,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-16T04:41:52.686Z","status":"ssl_error","status_checked_at":"2026-05-16T04:41:52.009Z","response_time":115,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-10T10:13:58.938Z","updated_at":"2026-05-16T15:02:37.089Z","avatar_url":"https://github.com/james2doyle.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"pico_useragent\n==============\n\nA plugin for [Pico CMS](http://pico.dev7studios.com/) that allows you to parse the user agent of the current visitor and then expose that information in an easy to use variable in your twig templates.\n\nHopefully that makese sense.\n\n### Output\n\nWhen using the plugin, you get a new variable called `browser`. The browser variable has the following properties in it when dumped from my computer:\n\n```php\n$browser = array (\n  'useragent'   =\u003e 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/30.0.1599.37 Safari/537.36' // full ua string\n  'name'        =\u003e 'Google Chrome' // name of the browser\n  'browser'     =\u003e 'google-chrome' // CSS safe browser name\n  'version'     =\u003e '30.0.1599.37' // bowser version\n  'type'        =\u003e 'desktop' // device form factor\n  'platform'    =\u003e 'mac' // OS platform\n  'pattern'     =\u003e '#(?Version|Chrome|other)[/ ]+(?[0-9.|a-zA-Z.]*)#' // match pattern\n);\n```\n\n### Example\n\nI use this example when I want to make small modifications to my CSS. Not unlike how Modernizr is supposed to work. Except modernizr doesn't give you browser information.\n\n```html\n\u003chtml lang=\"en\" class=\"{{ browser.browser }} {{ browser.platform }} {{ browser.type }}\"\u003e\n```\n\nHere is the output for that html tag:\n\n```html\n\u003chtml lang=\"en\" class=\"google-chrome mac desktop\"\u003e\n```\n\nI usually use it to normalize issues across different browsers. Like something looking weird in Firefox, so I know I can modify some CSS by using a `.firefox` parent.\n\n```css\n.button {\n  padding: 0.25em 1em;\n}\n/* fix padding in FF */\n.firefox .button {\n  padding: 0.28em 1em;\n}\n```\n\n### Use Cases\n\n* conditional content\n* conditional styles/scripts\n* layout modifications\n* serving specific images\n* Modernizr-esque CSS classes\n\n### License\n\n**The MIT License**\n\nCopyright (c) 2013 [James Doyle](http://twitter.com/james2doyle) james2doyle@gmail.com\n\nPermission is hereby granted, free of charge, to any person obtaining\na copy of this software and associated documentation files (the\n'Software'), to deal in the Software without restriction, including\nwithout limitation the rights to use, copy, modify, merge, publish,\ndistribute, sublicense, and/or sell copies of the Software, and to\npermit persons to whom the Software is furnished to do so, subject to\nthe following conditions:\n\nThe above copyright notice and this permission notice shall be\nincluded in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\nIN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\nCLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\nTORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\nSOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjames2doyle%2Fpico_useragent","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjames2doyle%2Fpico_useragent","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjames2doyle%2Fpico_useragent/lists"}