{"id":13596532,"url":"https://github.com/browscap/browscap","last_synced_at":"2026-04-05T17:38:27.377Z","repository":{"id":6560850,"uuid":"7802677","full_name":"browscap/browscap","owner":"browscap","description":":page_with_curl: The main project repository","archived":false,"fork":false,"pushed_at":"2024-04-10T05:35:47.000Z","size":39625,"stargazers_count":419,"open_issues_count":1,"forks_count":68,"subscribers_count":37,"default_branch":"6.1.x","last_synced_at":"2024-04-10T06:33:48.989Z","etag":null,"topics":["detect","php","ua-parser","user-agent","user-agent-parser"],"latest_commit_sha":null,"homepage":"http://browscap.org/","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/browscap.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2013-01-24T16:58:26.000Z","updated_at":"2024-04-15T06:53:57.353Z","dependencies_parsed_at":"2024-04-15T06:53:45.791Z","dependency_job_id":null,"html_url":"https://github.com/browscap/browscap","commit_stats":{"total_commits":4868,"total_committers":42,"mean_commits":115.9047619047619,"dds":0.4965078060805259,"last_synced_commit":"b6177933686eca889fccd7fdceedf3538aaa6414"},"previous_names":[],"tags_count":79,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/browscap%2Fbrowscap","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/browscap%2Fbrowscap/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/browscap%2Fbrowscap/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/browscap%2Fbrowscap/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/browscap","download_url":"https://codeload.github.com/browscap/browscap/tar.gz/refs/heads/6.1.x","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248067976,"owners_count":21042393,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["detect","php","ua-parser","user-agent","user-agent-parser"],"created_at":"2024-08-01T16:02:33.083Z","updated_at":"2025-12-17T01:44:08.523Z","avatar_url":"https://github.com/browscap.png","language":"PHP","funding_links":[],"categories":["PHP"],"sub_categories":[],"readme":"# Browser Capabilities Project\n\n[![Continuous Integration](https://github.com/browscap/browscap/actions/workflows/continuous-integration.yml/badge.svg)](https://github.com/browscap/browscap/actions/workflows/continuous-integration.yml)\n[![codecov](https://codecov.io/gh/browscap/browscap/branch/master/graph/badge.svg)](https://codecov.io/gh/browscap/browscap)\n\nThis tool is used to build and maintain browscap files.\n\n## Installation\n\n```\n$ git clone git://github.com/browscap/browscap.git\n$ cd browscap\n$ curl -s https://getcomposer.org/installer | php\n$ php composer.phar install\n```\n\n## What's changed in version 6048\n* https://github.com/browscap/browscap/pull/2535 Added recent new Apple platforms (Mac OS, iOS and iPadOS)\n\n## What's changed in version 6028\n\n### BC breaks listed\n\n * Interface changed for class \\Browscap\\Data\\Factory\\UserAgentFactory\n\n## What's changed in version 6027\n\n### BC breaks listed\n\n * Strict type hints have been added throughout. This may break some type assumptions made in earlier versions.\n * In many classes Setters and Getters have been removed, the parameters have been moved to the class constructor\n * Some classes are now `final` - use composition instead of inheritance\n\n## What's changed in version 6025\n\n### BC breaks listed\n\n * The `grep` command and the `diff` command were removed\n\n### Changes\n\n * The tests for integration testing the source files are split from the other tests\n * Tests on travis use the build pipeline now\n\n## Directory Structure\n\n* `bin` - Contains executable files\n* `build` - Contains various builds\n* `resources` - Files needed to build the various files, also used to validate the capabilities\n* `src` - The code of this project lives here\n* `tests` - The testing code of this project lives here\n\n## the CLI commands\n\nThere is actually only one cli command available.\n\n### build\n\nThis command is used to build a set of defined browscap files.\n\n```php\nbin/browscap build [version]\n```\n\n#### options\n\n- `version` (required) the name of the version that should be built\n- `output` (optional) the directory where the files should be created\n- `resources` (optional) the directory where the sources for the build are located\n- `coverage` (optional) if this option is set, during the build information is added which can be used to generate a coverage report\n- `no-zip` (optional) if this option is set, no zip file is generated during the build\n\nFor further documentation on the `build` command, [see here](https://github.com/browscap/browscap/wiki/Build-Command).\n\n## CLI Examples\n\nYou can export a new set of browscap files:\n\n```\n$ bin/browscap build 5020-test\nResource folder: \u003cyour source dir\u003e\nBuild folder: \u003cyour target dir\u003e\nGenerating full_asp_browscap.ini [ASP/FULL]\nGenerating full_php_browscap.ini [PHP/FULL]\nGenerating browscap.ini [ASP]\nGenerating php_browscap.ini [PHP]\n...\nAll done.\n$\n```\n\nNow you if you look at `browscap/browscap.ini` you will see a new INI file has been generated.\n\n## Usage Examples\n\n### How to build a standard set of browscap files\n\nThis example assumes that you want to build all *php_browscap.ini files.\n\n```php\n$logger = new \\Monolog\\Logger('browscap'); // or maybe any other PSR-3 compatible Logger\n\n$format = \\Browscap\\Formatter\\FormatterInterface::TYPE_PHP; // you may choose the output format you want, the format must be already supported\n\n$resourceFolder = 'resources/'; // please point to the resources directory inside the project\n$buildFolder = ''; // choose the directory where the generated file should be written to\n\n// If you are using one of the predefined WriterFactories, you may not choose the file names\n$writerCollection = (new \\Browscap\\Writer\\Factory\\PhpWriterFactory())-\u003ecreateCollection($logger, $buildFolder);\n\n$dataCollectionFactory = new \\Browscap\\Data\\Factory\\DataCollectionFactory($logger);\n\n$buildGenerator = new BuildGenerator(\n    $resourceFolder,\n    $buildFolder,\n    $logger,\n    $writerCollection,\n    $dataCollectionFactory\n);\n\n$version       = '';    // what you want to be written into the generated file\n$createZipFile = false; // It is not possible yet to create a zipped version of a custom named browscap file\n\n$buildGenerator-\u003erun($version, $createZipFile);\n```\n\n### How to build a custom set of browscap files\n\nIf you want to build a custom set of browscap files, you may not use the predefined WriterFactories.\n\n```php\n$logger = new \\Monolog\\Logger('browscap'); // or maybe any other PSR-3 compatible Logger\n\n$format = \\Browscap\\Formatter\\FormatterInterface::TYPE_PHP; // you may choose the output format you want, the format must be already supported\n\n$resourceFolder = 'resources/'; // please point to the resources directory inside the project\n$buildFolder = ''; // choose the directory where the generated file should be written to\n\n$propertyHolder = new \\Browscap\\Data\\PropertyHolder();\n\n// build a standard version browscap.json file\n$jsonFormatter = new \\Browscap\\Formatter\\JsonFormatter($propertyHolder);\n$jsonFilter    = new \\Browscap\\Filter\\StandardFilter($propertyHolder);\n\n$jsonWriter = new \\Browscap\\Writer\\JsonWriter('relative path or name of the target file', $logger);\n$jsonWriter-\u003esetFormatter($jsonFormatter);\n$jsonWriter-\u003esetFilter($jsonFilter);\n\n// build a lite version browscap.xml file\n$xmlFormatter = new \\Browscap\\Formatter\\XmlFormatter($propertyHolder);\n$xmlFilter    = new \\Browscap\\Filter\\LiteFilter($propertyHolder);\n\n$xmlWriter = new \\Browscap\\Writer\\XmlWriter('relative path or name of the target file', $logger);\n$xmlWriter-\u003esetFormatter($xmlFormatter);\n$xmlWriter-\u003esetFilter($xmlFilter);\n\n$writerCollection = new \\Browscap\\Writer\\WriterCollection();\n$writerCollection-\u003eaddWriter($jsonWriter);\n$writerCollection-\u003eaddWriter($xmlWriter);\n\n$dataCollectionFactory = new \\Browscap\\Data\\Factory\\DataCollectionFactory($logger);\n\n$buildGenerator = new BuildGenerator(\n    $resourceFolder,\n    $buildFolder,\n    $logger,\n    $writerCollection,\n    $dataCollectionFactory\n);\n\n$version       = '';    // what you want to be written into the generated file\n$createZipFile = false; // It is not possible yet to create a zipped version of a custom named browscap file\n\n$buildGenerator-\u003erun($version, $createZipFile);\n```\n\n### How to build a custom browscap.ini\n\nIf you want to build a custom browscap file you may choose the file name and the fields which are included.\n\nNote: It is not possible to build a custom browscap.ini file with the CLI command.\n\n```php\n$logger = new \\Monolog\\Logger('browscap'); // or maybe any other PSR-3 compatible Logger\n// If using Monolog, you need specify a log handler, e.g. for STDOUT: $logger-\u003epushHandler(new \\Monolog\\Handler\\ErrorLogHandler());\n\n$format = \\Browscap\\Formatter\\FormatterInterface::TYPE_PHP; // you may choose the output format you want, the format must be already supported\n$file   = null; // you may set a custom file name here\n$fields = []; // choose the fields you want inside of your browscap file\n\n$resourceFolder = 'resources/'; // please point to the resources directory inside the project\n$buildFolder = ''; // choose the directory where the generated file should be written to\n\n$writerCollection = (new \\Browscap\\Writer\\Factory\\CustomWriterFactory())-\u003ecreateCollection($logger, $buildFolder, $file, $fields, $format);\n\n$dataCollectionFactory = new \\Browscap\\Data\\Factory\\DataCollectionFactory($logger);\n\n$buildGenerator = new BuildGenerator(\n    $resourceFolder,\n    $buildFolder,\n    $logger,\n    $writerCollection,\n    $dataCollectionFactory\n);\n\n$version       = ''; // version you want to be written into the generated file\n$dateTime      = new \\DateTimeImmutable(); // date you want to be written into the generated file\n$createZipFile = false; // It is not possible yet to create a zipped version of a custom named browscap file\n\n$buildGenerator-\u003erun($version, $dateTime, $createZipFile);\n```\n\n## Issues and feature requests\n\nPlease report your issues and ask for new features on the GitHub Issue Tracker at https://github.com/browscap/browscap/issues\n\n### Contributing\n\nFor instructions on how to contribute see the [CONTRIBUTE.md](https://github.com/browscap/browscap/blob/master/CONTRIBUTING.md) file.\n\n### License\n\nSee the [LICENSE](https://github.com/browscap/browscap/blob/master/LICENSE) file.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbrowscap%2Fbrowscap","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbrowscap%2Fbrowscap","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbrowscap%2Fbrowscap/lists"}