New in Symfony 2.8: Polyfill Components

In web development, a polyfill is"additional code which provides facilities
that are not built into a web browser". They are wildly popular in JavaScript
applications because they provide a uniform API regardless of the features
provided by users' browsers.

This was the very same issue that Symfony was increasingly facing as more
diverse PHP versions were being supported, from the ancient PHP 5.3.3 (released
on July 2010!) to the cutting-edge PHP 7.0. The differences in those PHP
versions made us include lots of PHP version comparisons:

Supporting five different PHP branches across the entire Symfony codebase was
becoming a maintenance hell. For that reason, we decided to create several small
polyfill components to "fill the gaps" of PHP 5.x versions and missing extensions.

For example, to use some of the great new PHP functions provided by PHP 7.0 in
any PHP 5.x application, you just need to install the symfony/polyfill-php70
component:

1

$ composer require symfony/polyfill-php70

Now your project can start using these functions included natively in PHP 7 and
provided via PHP 5.x code by this component:

If you think that some other polyfill might be useful for Symfony or PHP in
general, open an issue in the main symfony/polyfill repository and ask
for it. You can also propose your own polyfill code, as long as it meets the
Symfony quality standard and provides behavior parity with the native version.