Download the PHP package veronalabs/browscap-php without Composer

On this page you can find all versions of the php package veronalabs/browscap-php. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package browscap-php

Browser Capabilities PHP Project

This is a userland replacement for PHP's native get_browser() function, which is officially supported by the Browser Capabilities Project.

CI

Installation

Run the command below to install via Composer

Then you may identify the current user agent this way:

Recommended Setup

Before you can start, you have to run the browscap:fetch command to download the browscap.ini file, and use the browscap:convert command to convert it into a cache. There are two ways.

a. Download the file and convert it in two steps. The downloaded file will be stored in a local file, but there is no check if the remote file has changed. If your cache gets corrupted you only need to rerun the convert command.

b. Download the file and convert it in one step. The downloaded file will not be stored in a local file, but there is a check if the remote file has changed. If your cache gets corrupted you have clean the cache and restart the process.

If you want to autoupdate the used cache, we recommend a separate cron job that calls the command listed above.

BC breaks in version 7.0.x

Setup Examples

NOTE: You may use any other cache which implements the PSR-16 interface.

Using the full browscap.ini file

Setting up a proxy configuration

If you are behind a proxy or need a spcific configuration, you have to set up a client instance. See into the Guzzle documentation for more information about this.

Usage Examples

Taking the user agent from the global $_SERVER variable

Using a sample useragent

the CLI commands

NOTE: If you don't want to use a file cache, you could not use the CLI commands. It is not possible to use other caches there at the moment. NOTE: Each operation (fetch, update, check-update) which fetches data from the remote host browscap.org may run into the rate limit of that site. If this happens an Exception is thrown.

Each CLI command returns zero if everything went fine.

check-update

If you only want to check if a new version of the browscap.ini is available, you can use the check-update command.

options

return codes

fetch

The fetch command downloads an ini file from browscap.org.

options

return codes

convert

The convert command reads a local stored browscap.ini file and writes the contents into a cache.

options

return codes

update

The update command downloads an ini file from browscap.org and writes the contents into a cache. No local files are created.

options

return codes

parse

The parse command parses a given user agent and writes the result to the console.

options

return codes

CLI Examples

Updating the cache using the full browscap.ini file

Note: Both ways to create/update the cache will use the standard mode file as default. If you want more detailed information you may change this with the remote-file option. Please use the help function this parameter.

Updating a custom cache dir

Each operation expect fetch uses a cache inside the resources directory inside the project. If you update this library with composer, the cache is cleared also. If you want to avoid this and want to set your own cache folder, you can use the cache option. If you do this, you have to set a Cache Instance for this this path.

Issues and feature requests

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

Please report incorrectly identified User Agents and browser detect in the browscap.ini file here: https://github.com/browscap/browscap/issues


All versions of browscap-php with dependencies

PHP Build Version
Package Version
Requires php Version ~8.1.0 || ~8.2.0 || ~8.3.0
ext-json Version *
guzzlehttp/guzzle Version ^7.8.0
league/flysystem Version ^3.21.0
matthiasmullie/scrapbook Version ^1.5.1
monolog/monolog Version ^3.5.0
psr/log Version ^2.0.0 || ^3.0.0
psr/simple-cache Version ^2.0.0 || ^3.0.0
symfony/console Version ^6.4.0 || ^7.0.0
symfony/filesystem Version ^6.4.0 || ^7.0.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package veronalabs/browscap-php contains the following files

Loading the files please wait ....