PHPackages                             fisharebest/php-polyfill - 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. fisharebest/php-polyfill

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

fisharebest/php-polyfill
========================

Polyfills for PHP 5.3 onwards

1.7.0(6y ago)77.8k1MIT and GPL-3.0+PHPCI failing

Since Dec 18Pushed 6y ago1 watchersCompare

[ Source](https://github.com/fisharebest/php-polyfill)[ Packagist](https://packagist.org/packages/fisharebest/php-polyfill)[ Docs](https://github.com/fisharebest/php-polyfill)[ RSS](/packages/fisharebest-php-polyfill/feed)WikiDiscussions master Synced 3w ago

READMEChangelog (2)Dependencies (17)Versions (10)Used By (0)

[![Latest Stable Version](https://camo.githubusercontent.com/5d9e2c29b901ccf04f17fbf76bd6c5b4fe4ce626c0e29968b20a2b6c40be9111/68747470733a2f2f706f7365722e707567782e6f72672f66697368617265626573742f7068702d706f6c7966696c6c2f762f737461626c652e737667)](https://packagist.org/packages/fisharebest/php-polyfill)[![Build Status](https://camo.githubusercontent.com/940c705fc09bd8012f7c1a4921d27c8f56d92ba90f08a211cc6b8b16f1e46d9c/68747470733a2f2f7472617669732d63692e6f72672f66697368617265626573742f7068702d706f6c7966696c6c2e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/fisharebest/php-polyfill)[![StyleCI](https://camo.githubusercontent.com/d75f0798efa0d372cda67f6789be6d19fa8b9504a4073a54cb85ebbc9038e0f8/68747470733a2f2f6769746875622e7374796c6563692e696f2f7265706f732f34373833373938392f736869656c64)](https://github.styleci.io/repos/47837989)[![Coverage Status](https://camo.githubusercontent.com/08e471f6001ebdcb7910eba028ce05c73d537e1c25b920a6bba4cb036a6a22c3/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f66697368617265626573742f7068702d706f6c7966696c6c2f62616467652e7376673f6272616e63683d6d617374657226736572766963653d676974687562)](https://coveralls.io/github/fisharebest/php-polyfill?branch=master)

PHP Polyfill
============

[](#php-polyfill)

This project combines a number of other PHP polyfill libraries as well as providing many polyfills of its own.

Where possible, our polyfills are passed upstream to other packages. Ideally, there would be no code in this package - just a list of dependencies that work together.

The symfony project will only accept contributions that are 100% compatible with the native PHP implementation. In many cases, this isn't actually possible - it’s often why the functions were added to PHP in the first place!

So, this project provides implementations that are often “good enough” to get your application working on both new/old versions of PHP at the same time. Restrictions and limitations are described below.

Of course, if you know exactly which PHP functions in your project might not be available on other servers, then you can just include the polyfills you need. But if life is too short, then just include `fisharebest/php-polyfill` and not worry about it.

Usage
=====

[](#usage)

Add the dependency to your `composer.json` and allow autoloading magic to do the rest.

```
{
    "require": {
        "fisharebest/php-polyfill": "~1.6",
    },
}
```

The following polyfill libraries will be loaded automatically:

- `fisharebest/ext-calendar` - polyfills for the calendar functions
- `jakeasmith/http_build_url` - polyfill for the function `http_build_url()`
- `symfony/polyfill-apcu` - APCu functions
- `symfony/polyfill-iconv` - iconv functions
- `symfony/polyfill-intl-grapheme` - grapheme\_\* functions
- `symfony/polyfill-intl-icu` - intl functions and classes
- `symfony/polyfill-intl-normalizer` - normalizer functions and classes
- `symfony/polyfill-intl-mbstring` - mbstring functions
- `symfony/polyfill-intl-util` - core polyfill functions
- `symfony/polyfill-intl-xml` - utf8\_encode/decode functions
- `symfony/polyfill-php54` - PHP 5.4 functions
- `symfony/polyfill-php55` - PHP 5.5 functions
    - `ircmaxell/password_compat` - polyfills for password functions
- `symfony/polyfill-php56` - PHP 5.6 functions
- `symfony/polyfill-php70` - PHP 7.0 functions
    - `paragonie/random_compat` - random number functions

The following additional polyfills are provided by this package:

PHP 5.3
=======

[](#php-53)

- If the server has enabled `magic quotes`, these are removed.
- If the server has enabled `bug_compat_42`, this is disabled.

PHP 5.4
=======

[](#php-54)

- `http_response_code()` - The native function allows you to get the current status code, even if it was set using another function, such as `header()`. This implementation can only get the current status code if it was also set by `http_response_code()`.

PHP (general)
=============

[](#php-general)

- Some builds of PHP (such as the one used by strato.de) do not define the constant `INF`.

Contributions
=============

[](#contributions)

Please follow the existing code style and write unit-tests where you can.

License
=======

[](#license)

This package is dual licensed under both the [MIT](LICENSE-MIT.md) and [GPLv3](LICENSE-GPLv3.md) licenses. Use whichever makes you happiest.

###  Health Score

35

—

LowBetter than 77% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity27

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity69

Established project with proven stability

 Bus Factor1

Top contributor holds 92.3% 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 ~216 days

Recently: every ~370 days

Total

8

Last Release

2322d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/2306088?v=4)[Greg Roach](/maintainers/fisharebest)[@fisharebest](https://github.com/fisharebest)

---

Top Contributors

[![fisharebest](https://avatars.githubusercontent.com/u/2306088?v=4)](https://github.com/fisharebest "fisharebest (12 commits)")[![echernyavskiy](https://avatars.githubusercontent.com/u/1200767?v=4)](https://github.com/echernyavskiy "echernyavskiy (1 commits)")

---

Tags

compatibilitypolyfillshimphpcompat

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/fisharebest-php-polyfill/health.svg)

```
[![Health](https://phpackages.com/badges/fisharebest-php-polyfill/health.svg)](https://phpackages.com/packages/fisharebest-php-polyfill)
```

###  Alternatives

[symfony/symfony

The Symfony PHP framework

31.4k86.9M2.2k](/packages/symfony-symfony)[symfony/string

Provides an object-oriented API to strings and deals with bytes, UTF-8 code points and grapheme clusters in a unified way

1.8k759.1M1.2k](/packages/symfony-string)[symfony/polyfill-intl-idn

Symfony polyfill for intl's idn\_to\_ascii and idn\_to\_utf8 functions

3.4k806.5M131](/packages/symfony-polyfill-intl-idn)[voku/portable-utf8

Portable UTF-8 library - performance optimized (unicode) string functions for php.

51923.1M48](/packages/voku-portable-utf8)[matomo/matomo

Matomo is the leading Free/Libre open analytics platform

21.6k38.2k](/packages/matomo-matomo)[drupal/core-recommended

Locked core dependencies; require this project INSTEAD OF drupal/core.

6941.5M396](/packages/drupal-core-recommended)

PHPackages © 2026

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