Download the PHP package pataar/browser-detect without Composer

On this page you can find all versions of the php package pataar/browser-detect. 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 browser-detect

Browser Detect

Latest Stable Version Build PHPStan Coverage Status Total Downloads License

A Laravel package to identify the visitor's browser, operating system, and device type. Results are powered by two well-tested detection libraries — no magic involved.

Fork notice: This is a maintained fork of hisorange/browser-detect by Varga Zsolt, which appears to be abandoned. Full credit to the original author for the design and initial implementation.

Changes from the original

Requirements

Installation

That's it — Laravel auto-discovers the service provider and facade.

Usage

Facade

Blade directives

Standalone (without Laravel)

Parsing a specific user agent

Results are cached in memory for the current request and optionally persisted via Laravel's cache (7-day TTL by default).

API Reference

Device detection

Method Returns Description
Browser::isMobile() bool Is this a mobile device?
Browser::isTablet() bool Is this a tablet device?
Browser::isDesktop() bool Is this a desktop computer?
Browser::isBot() bool Is this a crawler / bot?
Browser::deviceType() string One of: Mobile, Tablet, Desktop, Bot
Browser::deviceFamily() string Device vendor (Samsung, Apple, Huawei, ...)
Browser::deviceModel() string Device model (iPad, iPhone, Nexus, ...)

Browser detection

Method Returns Description
Browser::browserName() string Human-friendly name (e.g. Firefox 3.6)
Browser::browserFamily() string Vendor (Chrome, Firefox, Opera, ...)
Browser::browserVersion() string Version string with trailing .0 trimmed
Browser::browserVersionMajor() int Semantic major version
Browser::browserVersionMinor() int Semantic minor version
Browser::browserVersionPatch() int Semantic patch version
Browser::browserEngine() string Rendering engine (Blink, WebKit, Gecko, ...)
Browser::isChrome() bool Chrome or Chromium?
Browser::isFirefox() bool Firefox?
Browser::isOpera() bool Opera?
Browser::isSafari() bool Safari?
Browser::isEdge() bool Microsoft Edge?
Browser::isIE() bool Internet Explorer (or Trident)?
Browser::isIEVersion(int, op) bool Compare against a specific IE version
Browser::isInApp() bool In-app browser (WebView, Twitter, WeChat)?

Operating system detection

Method Returns Description
Browser::platformName() string Human-friendly name (e.g. Windows 10)
Browser::platformFamily() string Vendor (Linux, Windows, Mac, ...)
Browser::platformVersion() string Version string with trailing .0 trimmed
Browser::platformVersionMajor() int Semantic major version
Browser::platformVersionMinor() int Semantic minor version
Browser::platformVersionPatch() int Semantic patch version
Browser::isWindows() bool Windows?
Browser::isLinux() bool Linux?
Browser::isMac() bool macOS or iOS?
Browser::isAndroid() bool Android?

Configuration

In Laravel, publish the config file:

In standalone mode, pass a custom config array:

Available options:

Key Default Description
cache.interval 10080 Cache TTL in seconds
cache.prefix bd4_ Cache key prefix
cache.device-detector null Cache driver for device-detector's internal cache. See config/browser-detect.php for examples.
security.max-header-length 2048 Max user agent length (DoS protection)

Quality

This package aims for 100% test coverage and PHPStan level max with zero baseline errors.

Credits

This package was originally created by Varga Zsolt (hisorange). This fork is maintained by Pieter Willekens (pataar).

Detection is powered by:

License

MIT


All versions of browser-detect with dependencies

PHP Build Version
Package Version
Requires php Version ^8.3
jaybizzle/crawler-detect Version ^1.2
matomo/device-detector Version ^6.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 pataar/browser-detect contains the following files

Loading the files please wait ...