PHPackages                             creative-web-solution/front-polyfill-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. creative-web-solution/front-polyfill-bundle

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

creative-web-solution/front-polyfill-bundle
===========================================

Generate the necessary polyfill.

1.5.2(3y ago)09.1k—3.4%MITPHPPHP &gt;=7.1

Since Aug 22Pushed 3y ago3 watchersCompare

[ Source](https://github.com/creative-web-solution/front-polyfill-bundle)[ Packagist](https://packagist.org/packages/creative-web-solution/front-polyfill-bundle)[ RSS](/packages/creative-web-solution-front-polyfill-bundle/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (5)Dependencies (5)Versions (13)Used By (0)

Front polyfill bundle by CWS
============================

[](#front-polyfill-bundle-by-cws)

Configuration
-------------

[](#configuration)

**Create a YAML file:**

You can copy the `Resources/sample/config.yaml` in your app (in `/frontend/polyfill/config.yaml` for example).

You can configure this path by overriding this parameters in your app:

```
parameters:
    cws.polyfill.config_path: /frontend/polyfill/config.yaml

```

Activate the polyfills you need by setting `active: true` in this config file.

Services
--------

[](#services)

Add this line in the import section of your **services.yaml**

```
imports:
    - { resource: '@CwsFrontPolyfillBundle/Resources/config/services.xml' }

```

Javascript support tests
------------------------

[](#javascript-support-tests)

Get the active polyfill list:

**With an object list**

```
{% set polyfillList = get_front_polyfill_list() %}

var myPolyfillArray = [
{%- for name, polyfill in polyfillList.list -%}
    {
        "test": {{ polyfill.test|raw }},
        "name": "{{ name|raw }}"
    }{{ loop.last ? '' : ',' }}
{%- endfor -%}
];

```

**With a JS array-like string**

```
var myPolyfillArray = {{ get_front_polyfill_list('js') }};
```

This will give :

```
var myPolyfillArray = [
    {
        "test": test1,
        "name": "test1"
    },{
        "test": test2,
        "name": "test2"
    },
    ...
];
```

You can change the name of the properties:

```
var myPolyfillArray = {{ get_front_polyfill_list('js', 'a', 'b') }};
```

Results in :

```
var myPolyfillArray = [{
        "b": test1,
        "a": "test1"
    },{
        "b": test2,
        "a": "test2"
    },
    ...
];
```

Here a full example to create an url like 'js/pf1-pf2-pf3.js':

```
{% set polyfillArrayString = get_front_polyfill_list('js') %}

    let polyfillContentUrl;

    {%- if polyfillArrayString is defined and polyfillArrayString|length > 2 -%}
        let neededPolyfill = [];

        {{ polyfillArrayString }}
            .forEach( function( polyfill ) {
                if (typeof polyfill.test === 'function' && polyfill.test() ||
                    typeof polyfill.test !== 'function' && polyfill.test) {
                    neededPolyfill.push( polyfill.name );
                }
            });

        if ( neededPolyfill.length ) {
            polyfillContentUrl = `js/${ neededPolyfill.join( '-' ) }.js`;
        }
    {%- endif -%}

    [
        polyfillContentUrl,
        '1.js',
        '2.js'
    ].forEach( function( src ) {
        if ( !src ) {
            return;
        }
        var script = document.createElement('script');
        script.src = src;
        script.async = false;
        document.head.appendChild(script);
    } );

```

Polyfill loading
----------------

[](#polyfill-loading)

Use the array of test to create an url to load the polyfill content.

There is 2 ways to load the polyfills:

### 1/ The polyfill names are contained in the filename itself and separated by `-`

[](#1-the-polyfill-names-are-contained-in-the-filename-itself-and-separated-by--)

This is the **recommended way** to do it because this way allow you **to create a real file**. Handy with Symfony as if the file exists, **it will not be rerendered**.

```

```

Inside the Twig file that render the response for `polyfill-domch-eachnl-picture.js` (and save the file if you want):

```
{{ get_front_polyfill_content()|raw }}

// Other stuff in JS

```

The route to this file **MUST** contains a placeholder. By default its name is `polyfill_list`. So, in our example `/js/polyfill-domch-eachnl-picture.js`, the route must be `/js/polyfill-{polyfill_list}.js`

You can configure the placeholder name in the `parameters.yaml`:

```
parameters:
    cws.polyfill.route_placeholder: polyfill_list

```

**When there is a clear cache action, it is recommended to delete those generated files as well.**

### 2/ The polyfill names are contained in the query string and separated by `&`

[](#2-the-polyfill-names-are-contained-in-the-query-string-and-separated-by-)

```

```

Tou have to specify it using the parameter `query` of the `get_front_polyfill_content` TWIG function.

Inside the Twig file that render the response for `polyfill.js`:

```
{{ get_front_polyfill_content('query')|raw }}

// Other stuff in JS

```

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity22

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity60

Established project with proven stability

 Bus Factor1

Top contributor holds 58.6% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~116 days

Recently: every ~170 days

Total

11

Last Release

1291d ago

PHP version history (2 changes)v1.0.0PHP ^7.1

1.5.0PHP &gt;=7.1

### Community

Maintainers

![](https://www.gravatar.com/avatar/45b1fad7ac68a5b360b3e075470d6ba12f054e21d40402aa209e8a13875bd408?d=identicon)[ChristopheDufourg](/maintainers/ChristopheDufourg)

![](https://www.gravatar.com/avatar/01a6edfc28fdd5980ebea998fa551dee03468a3f1d481103ea275d18cec3a6cb?d=identicon)[Tw4n](/maintainers/Tw4n)

---

Top Contributors

[![ChristopheDufourg](https://avatars.githubusercontent.com/u/38108071?v=4)](https://github.com/ChristopheDufourg "ChristopheDufourg (17 commits)")[![elyanory](https://avatars.githubusercontent.com/u/6603242?v=4)](https://github.com/elyanory "elyanory (12 commits)")

---

Tags

bundlepolyfillpolyfillssymfonysymfony4polyfillbundlesymfony4frontcwscreative-web-solution

### Embed Badge

![Health badge](/badges/creative-web-solution-front-polyfill-bundle/health.svg)

```
[![Health](https://phpackages.com/badges/creative-web-solution-front-polyfill-bundle/health.svg)](https://phpackages.com/packages/creative-web-solution-front-polyfill-bundle)
```

###  Alternatives

[simplesamlphp/simplesamlphp

A PHP implementation of a SAML 2.0 service provider and identity provider.

1.1k12.4M190](/packages/simplesamlphp-simplesamlphp)[shopware/platform

The Shopware e-commerce core

3.3k1.5M3](/packages/shopware-platform)[sulu/sulu

Core framework that implements the functionality of the Sulu content management system

1.3k1.3M152](/packages/sulu-sulu)[prestashop/prestashop

PrestaShop is an Open Source e-commerce platform, committed to providing the best shopping cart experience for both merchants and customers.

9.0k15.4k](/packages/prestashop-prestashop)[pentatrion/vite-bundle

Vite integration for your Symfony app

2725.3M13](/packages/pentatrion-vite-bundle)[shopware/core

Shopware platform is the core for all Shopware ecommerce products.

595.2M385](/packages/shopware-core)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
