PHPackages                             barthy-koeln/browserslist-check-bundle - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. barthy-koeln/browserslist-check-bundle

AbandonedArchivedSymfony-bundle[Utility &amp; Helpers](/categories/utility)

barthy-koeln/browserslist-check-bundle
======================================

Detects browser versions, matches .browserslistrc files and serves encore builds accordingly.

v1.1.1(3y ago)3223MITPHPPHP ^7.4|^8.1

Since Oct 12Pushed 3y ago1 watchersCompare

[ Source](https://github.com/barthy-koeln/browserslist-check-bundle)[ Packagist](https://packagist.org/packages/barthy-koeln/browserslist-check-bundle)[ Docs](https://github.com/barthy-koeln/browserslist-check-bundle)[ GitHub Sponsors](https://github.com/barthy-koeln)[ GitHub Sponsors](https://github.com/donatj)[ RSS](/packages/barthy-koeln-browserslist-check-bundle/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (9)Dependencies (15)Versions (10)Used By (0)

Browserslist Check Bundle
=========================

[](#browserslist-check-bundle)

This bundle parses `.browserslistrc` files for a config called `modern`. It then provides a php service and a twig method to compare the user-agent string against this config.

It uses a great, light and fast [user agent parsing library](https://github.com/donatj/PhpUserAgent)by [@donatj](https://github.com/donatj).

The goal is to determine whether the browser requesting a response is "modern" in relation to JavaScript and CSS functionality.

You can use it to serve different front-end builds and save precious bandwidth for modern browsers by serving less polyfills, vendor prefixes and whatever else is handled by the `.broserslistrc`.

Installing
----------

[](#installing)

```
composer require barthy-koeln/browserslist-check-bundle
```

Config
------

[](#config)

Your `.browserslistrc` file should look like this:

```
[modern]
Chrome >= 97
Edge >= 97
Firefox >= 91
Safari >= 14.1
Opera >= 82
iOS >= 14.5
Samsung >= 15
ChromeAndroid >= 100
FirefoxAndroid >= 98
Android >= 99

[legacy]
defaults
ie 11
safari >= 13
iOS >= 13

```

Important notes:

- The `[modern]` config must be at the top
- The constraints within that build must only map browser names with minimum versions using the `>=` operator. Browsers with versions higher or equal are "modern".

Caching The Browser Configuration
---------------------------------

[](#caching-the-browser-configuration)

Your `.browserslistrc` file will be parsed and inlined as a PHP array when Symfony builds its cache.

Crawlers &amp; Bots
-------------------

[](#crawlers--bots)

This bundle recognizes a few evergreen crawlers capable of handling JavaScript and handles them as their browser counterpart (e.g. Chrome for Googlebot and Edge for Bingbot).

Simple Usage
------------

[](#simple-usage)

```

```

```
