fisharebest / php-polyfill
Polyfills for PHP 5.3 onwards
Installs: 7 344
Dependents: 0
Suggesters: 0
Security: 0
Stars: 7
Watchers: 3
Forks: 1
Open Issues: 0
Requires
- fisharebest/ext-calendar: ~2.5
- jakeasmith/http_build_url: ~1.0
- symfony/polyfill-apcu: ~1.14
- symfony/polyfill-iconv: ~1.14
- symfony/polyfill-intl-grapheme: ~1.14
- symfony/polyfill-intl-icu: ~1.14
- symfony/polyfill-intl-normalizer: ~1.14
- symfony/polyfill-mbstring: ~1.14
- symfony/polyfill-php54: ~1.14
- symfony/polyfill-php55: ~1.14
- symfony/polyfill-php56: ~1.14
- symfony/polyfill-php70: ~1.14
- symfony/polyfill-php71: ~1.14
- symfony/polyfill-php72: ~1.14
- symfony/polyfill-util: ~1.14
Requires (Dev)
This package is auto-updated.
Last update: 2024-10-13 22:44:21 UTC
README
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
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 functionsjakeasmith/http_build_url
- polyfill for the functionhttp_build_url()
symfony/polyfill-apcu
- APCu functionssymfony/polyfill-iconv
- iconv functionssymfony/polyfill-intl-grapheme
- grapheme_* functionssymfony/polyfill-intl-icu
- intl functions and classessymfony/polyfill-intl-normalizer
- normalizer functions and classessymfony/polyfill-intl-mbstring
- mbstring functionssymfony/polyfill-intl-util
- core polyfill functionssymfony/polyfill-intl-xml
- utf8_encode/decode functionssymfony/polyfill-php54
- PHP 5.4 functionssymfony/polyfill-php55
- PHP 5.5 functionsircmaxell/password_compat
- polyfills for password functions
symfony/polyfill-php56
- PHP 5.6 functionssymfony/polyfill-php70
- PHP 7.0 functionsparagonie/random_compat
- random number functions
The following additional polyfills are provided by this package:
PHP 5.3
- If the server has enabled
magic quotes
, these are removed. - If the server has enabled
bug_compat_42
, this is disabled.
PHP 5.4
http_response_code()
- The native function allows you to get the current status code, even if it was set using another function, such asheader()
. This implementation can only get the current status code if it was also set byhttp_response_code()
.
PHP (general)
- Some builds of PHP (such as the one used by strato.de) do not define the constant
INF
.
Contributions
Please follow the existing code style and write unit-tests where you can.
License
This package is dual licensed under both the MIT and GPLv3 licenses. Use whichever makes you happiest.