All Projects β†’ browscap β†’ Browscap

browscap / Browscap

Licence: mit
πŸ“ƒ The main project repository

Projects that are alternatives of or similar to Browscap

React Device Detect
Detect device, and render view according to detected device type.
Stars: ✭ 1,145 (+223.45%)
Mutual labels:  detect, user-agent
Crawler Detect
πŸ•· CrawlerDetect is a PHP class for detecting bots/crawlers/spiders via the user agent
Stars: ✭ 1,549 (+337.57%)
Mutual labels:  detect, user-agent
crawlerdetect
Golang module to detect bots and crawlers via the user agent
Stars: ✭ 22 (-93.79%)
Mutual labels:  user-agent, detect
ImageCropper
βœ‚οΈ Detect and crop faces, barcodes, texts or rectangle in image with iOS 11 Vision (iOS 10 Core Image) api.οΌˆε›Ύη‰‡θ£ε‰ͺοΌšζ”―ζŒδΊΊθ„Έγ€δΊŒη»΄η /ζ‘ε½’η γ€ζ–‡ζœ¬γ€ζ–Ήζ‘†οΌ‰
Stars: ✭ 17 (-95.2%)
Mutual labels:  detect
vue-if-bot
Hide stuff from bots (especially cookie consents)
Stars: ✭ 62 (-82.49%)
Mutual labels:  user-agent
Visitor-Parser-JS
Visitor Parser JS
Stars: ✭ 20 (-94.35%)
Mutual labels:  user-agent
Encoding.js
Convert or detect character encoding in JavaScript
Stars: ✭ 338 (-4.52%)
Mutual labels:  detect
hms-safetydetect-demo-android
SafetyDetect Sample provides many sample programs for your reference or usage.This example demonstrates how to integrate services provided by Safetydetect Kit, such as APPchecks, URLcheck, Userdetect, Wifidetect.
Stars: ✭ 16 (-95.48%)
Mutual labels:  detect
Ffdynamic
Library with dynamic audio/video composition and runtime control
Stars: ✭ 274 (-22.6%)
Mutual labels:  detect
whoami.js
A simple and lightweight browser detection and logger library
Stars: ✭ 16 (-95.48%)
Mutual labels:  user-agent
egjs-agent
Extracts browser and operating system information from the user agent string or user agent object(userAgentData).
Stars: ✭ 73 (-79.38%)
Mutual labels:  user-agent
connection checker
Android library for checking the internet connectivity of a device.
Stars: ✭ 26 (-92.66%)
Mutual labels:  detect
Facenet-Caffe
facenet recognition and retrieve by using hnswlib and flask, convert tensorflow model to caffe
Stars: ✭ 30 (-91.53%)
Mutual labels:  detect
scrollbar-width
Lightweight tool to get browser's scrollbars width of any browser.
Stars: ✭ 25 (-92.94%)
Mutual labels:  detect
Isbot
πŸ’» JavaScript module that detects bots/crawlers/spiders via the user agent
Stars: ✭ 290 (-18.08%)
Mutual labels:  user-agent
CleanUnwantedUpdates
A set of scripts to detect updates of Microsoft (TM) Windows (TM) OS which harm users' privacy and uninstall them
Stars: ✭ 24 (-93.22%)
Mutual labels:  detect
Platform.js
A platform detection library.
Stars: ✭ 2,937 (+729.66%)
Mutual labels:  user-agent
bots-zoo
No description or website provided.
Stars: ✭ 59 (-83.33%)
Mutual labels:  user-agent
get-installed-path
Get locally or globally installation path of given package name.
Stars: ✭ 39 (-88.98%)
Mutual labels:  detect
Server
Server written in PHP, provides a Javascript API for in the browser
Stars: ✭ 34 (-90.4%)
Mutual labels:  user-agent

Browser Capabilities Project

Build Status codecov

This tool is used to build and maintain browscap files.

Installation

$ git clone git://github.com/browscap/browscap.git
$ cd browscap
$ curl -s https://getcomposer.org/installer | php
$ php composer.phar install

What's changed in version 6028

BC breaks listed

  • Interface changed for class \Browscap\Data\Factory\UserAgentFactory

What's changed in version 6027

BC breaks listed

  • Strict type hints have been added throughout. This may break some type assumptions made in earlier versions.
  • In many classes Setters and Getters have been removed, the parameters have been moved to the class constructor
  • Some classes are now final - use composition instead of inheritance

What's changed in version 6025

BC breaks listed

  • The grep command and the diff command were removed

Changes

  • The tests for integration testing the source files are split from the other tests
  • Tests on travis use the build pipeline now

Directory Structure

  • bin - Contains executable files
  • build - Contains various builds
  • resources - Files needed to build the various files, also used to validate the capabilities
  • src - The code of this project lives here
  • tests - The testing code of this project lives here

the CLI commands

There is actually only one cli command available.

build

This command is used to build a set of defined browscap files.

bin/browscap build [version]

options

  • version (required) the name of the version that should be built
  • output (optional) the directory where the files should be created
  • resources (optional) the directory where the sources for the build are located
  • coverage (optional) if this option is set, during the build information is added which can be used to generate a coverage report
  • no-zip (optional) if this option is set, no zip file is generated during the build

For further documentation on the build command, see here.

CLI Examples

You can export a new set of browscap files:

$ bin/browscap build 5020-test
Resource folder: <your source dir>
Build folder: <your target dir>
Generating full_asp_browscap.ini [ASP/FULL]
Generating full_php_browscap.ini [PHP/FULL]
Generating browscap.ini [ASP]
Generating php_browscap.ini [PHP]
...
All done.
$

Now you if you look at browscap/browscap.ini you will see a new INI file has been generated.

Usage Examples

How to build a standard set of browscap files

This example assumes that you want to build all *php_browscap.ini files.

$logger = new \Monolog\Logger('browscap'); // or maybe any other PSR-3 compatible Logger

$format = \Browscap\Formatter\FormatterInterface::TYPE_PHP; // you may choose the output format you want, the format must be already supported

$resourceFolder = 'resources/'; // please point to the resources directory inside the project
$buildFolder = ''; // choose the directory where the generated file should be written to

// If you are using one of the predefined WriterFactories, you may not choose the file names
$writerCollection = (new \Browscap\Writer\Factory\PhpWriterFactory())->createCollection($logger, $buildFolder);

$dataCollectionFactory = new \Browscap\Data\Factory\DataCollectionFactory($logger);

$buildGenerator = new BuildGenerator(
    $resourceFolder,
    $buildFolder,
    $logger,
    $writerCollection,
    $dataCollectionFactory
);

$version       = '';    // what you want to be written into the generated file
$createZipFile = false; // It is not possible yet to create a zipped version of a custom named browscap file

$buildGenerator->run($version, $createZipFile);

How to build a custom set of browscap files

If you want to build a custom set of browscap files, you may not use the predefined WriterFactories.

$logger = new \Monolog\Logger('browscap'); // or maybe any other PSR-3 compatible Logger

$format = \Browscap\Formatter\FormatterInterface::TYPE_PHP; // you may choose the output format you want, the format must be already supported

$resourceFolder = 'resources/'; // please point to the resources directory inside the project
$buildFolder = ''; // choose the directory where the generated file should be written to

$propertyHolder = new \Browscap\Data\PropertyHolder();

// build a standard version browscap.json file
$jsonFormatter = new \Browscap\Formatter\JsonFormatter($propertyHolder);
$jsonFilter    = new \Browscap\Filter\StandardFilter($propertyHolder);

$jsonWriter = new \Browscap\Writer\JsonWriter('relative path or name of the target file', $logger);
$jsonWriter->setFormatter($jsonFormatter);
$jsonWriter->setFilter($jsonFilter);

// build a lite version browscap.xml file
$xmlFormatter = new \Browscap\Formatter\XmlFormatter($propertyHolder);
$xmlFilter    = new \Browscap\Filter\LiteFilter($propertyHolder);

$xmlWriter = new \Browscap\Writer\XmlWriter('relative path or name of the target file', $logger);
$xmlWriter->setFormatter($xmlFormatter);
$xmlWriter->setFilter($xmlFilter);

$writerCollection = new \Browscap\Writer\WriterCollection();
$writerCollection->addWriter($jsonWriter);
$writerCollection->addWriter($xmlWriter);

$dataCollectionFactory = new \Browscap\Data\Factory\DataCollectionFactory($logger);

$buildGenerator = new BuildGenerator(
    $resourceFolder,
    $buildFolder,
    $logger,
    $writerCollection,
    $dataCollectionFactory
);

$version       = '';    // what you want to be written into the generated file
$createZipFile = false; // It is not possible yet to create a zipped version of a custom named browscap file

$buildGenerator->run($version, $createZipFile);

How to build a custom browscap.ini

If you want to build a custom browscap file you may choose the file name and the fields which are included.

Note: It is not possible to build a custom browscap.ini file with the CLI command.

$logger = new \Monolog\Logger('browscap'); // or maybe any other PSR-3 compatible Logger

$format = \Browscap\Formatter\FormatterInterface::TYPE_PHP; // you may choose the output format you want, the format must be already supported
$file   = null; // you may set a custom file name here
$fields = []; // choose the fields you want inside of your browscap file

$resourceFolder = 'resources/'; // please point to the resources directory inside the project
$buildFolder = ''; // choose the directory where the generated file should be written to

$writerCollection = (new \Browscap\Writer\Factory\CustomWriterFactory())->createCollection($logger, $buildFolder, $file, $fields);

$dataCollectionFactory = new \Browscap\Data\Factory\DataCollectionFactory($logger);

$buildGenerator = new BuildGenerator(
    $resourceFolder,
    $buildFolder,
    $logger,
    $writerCollection,
    $dataCollectionFactory
);

$version       = '';    // what you want to be written into the generated file
$createZipFile = false; // It is not possible yet to create a zipped version of a custom named browscap file

$buildGenerator->run($version, $createZipFile);

Issues and feature requests

Please report your issues and ask for new features on the GitHub Issue Tracker at https://github.com/browscap/browscap/issues

Contributing

For instructions on how to contribute see the CONTRIBUTE.md file.

License

See the LICENSE file.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].