PHPackages                             alexsoft-software/phpbcl - 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. alexsoft-software/phpbcl

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

alexsoft-software/phpbcl
========================

PHP Backwards Compatibility Library (phpBCL).

2.1.0(4mo ago)00proprietaryPHPPHP &gt;=5.6

Since Apr 27Pushed 4mo ago1 watchersCompare

[ Source](https://github.com/alexsoft-software/phpbcl)[ Packagist](https://packagist.org/packages/alexsoft-software/phpbcl)[ Docs](https://apps.ascoos.com/phpBCL)[ RSS](/packages/alexsoft-software-phpbcl/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (3)DependenciesVersions (4)Used By (0)

[![](https://camo.githubusercontent.com/d690f7b97b9c56181382954307028c81bed13b353ae66b58eb7b073496defa75/68747470733a2f2f617070732e6173636f6f732e636f6d2f70687042434c2f696d616765732f70687042434c5f32353670782e706e67)](https://camo.githubusercontent.com/d690f7b97b9c56181382954307028c81bed13b353ae66b58eb7b073496defa75/68747470733a2f2f617070732e6173636f6f732e636f6d2f70687042434c2f696d616765732f70687042434c5f32353670782e706e67)

PHP Backwards Compatibility Library (phpBCL)
============================================

[](#php-backwards-compatibility-library-phpbcl)

[![PHP](https://camo.githubusercontent.com/2b7c84026b421701158158f623568c83e973b9c0e025c0a2f39ade2d5f4a4847/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f352e362b2d626c75653f7374796c653d666f722d7468652d6261646765266c6162656c3d504850266c6162656c436f6c6f723d30343166363026636f6c6f723d303334663834)](https://camo.githubusercontent.com/2b7c84026b421701158158f623568c83e973b9c0e025c0a2f39ade2d5f4a4847/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f352e362b2d626c75653f7374796c653d666f722d7468652d6261646765266c6162656c3d504850266c6162656c436f6c6f723d30343166363026636f6c6f723d303334663834)[![GitHub Downloads (all assets, all releases)](https://camo.githubusercontent.com/1c17583b97a4df48736349589da1f64c6cd2522f64c016c2a2964d07281cf4ea/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f646f776e6c6f6164732f6173636f6f732f70687062636c2f746f74616c3f7374796c653d666f722d7468652d626164676526636f6c6f723d253233304538304330)](https://camo.githubusercontent.com/1c17583b97a4df48736349589da1f64c6cd2522f64c016c2a2964d07281cf4ea/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f646f776e6c6f6164732f6173636f6f732f70687062636c2f746f74616c3f7374796c653d666f722d7468652d626164676526636f6c6f723d253233304538304330)[![GitHub Release](https://camo.githubusercontent.com/eb3972850b97adcd98ead86d9f664d2c5562c1e1f952b8aebd73784002f20f2b/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f762f72656c656173652f6173636f6f732f70687062636c3f7374796c653d666f722d7468652d6261646765)](https://camo.githubusercontent.com/eb3972850b97adcd98ead86d9f664d2c5562c1e1f952b8aebd73784002f20f2b/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f762f72656c656173652f6173636f6f732f70687062636c3f7374796c653d666f722d7468652d6261646765)[![GitHub Release Date](https://camo.githubusercontent.com/b186cb043597a61398b598a8b414657f448497553a54f898c7dbcca43a11f33c/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f72656c656173652d646174652f6173636f6f732f70687062636c3f7374796c653d666f722d7468652d626164676526636f6c6f723d253233304538304330)](https://camo.githubusercontent.com/b186cb043597a61398b598a8b414657f448497553a54f898c7dbcca43a11f33c/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f72656c656173652d646174652f6173636f6f732f70687062636c3f7374796c653d666f722d7468652d626164676526636f6c6f723d253233304538304330)[![GitHub repo size](https://camo.githubusercontent.com/e3850bf8589c3bbbb3cd1af2a24de878bb1263f4cb0fc4df6baf5862b6adbfc2/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f7265706f2d73697a652f6173636f6f732f70687062636c3f7374796c653d666f722d7468652d6261646765)](https://camo.githubusercontent.com/e3850bf8589c3bbbb3cd1af2a24de878bb1263f4cb0fc4df6baf5862b6adbfc2/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f7265706f2d73697a652f6173636f6f732f70687062636c3f7374796c653d666f722d7468652d6261646765)

Description
-----------

[](#description)

This package provides functions of newer PHP versions for older versions.

It provides scripts that implement functions only available in newer PHP versions as functions built-in in the PHP core engine. The parts work in older PHP versions.

A main script checks the current PHP version and loads that implement the functions of newer PHP versions.

---

### SOURCEFORGE

[](#sourceforge)

[![Download phpBCL](https://camo.githubusercontent.com/264e75579a2f3c0ed83c1d5dfce956b8dbac5b8febf363910ca08e1fac64e9e2/68747470733a2f2f696d672e736869656c64732e696f2f736f75726365666f7267652f64742f70687062636c2e7376673f7374796c653d666f722d7468652d6261646765)](https://sourceforge.net/projects/phpbcl/files/latest/download)[![Download phpBCL](https://camo.githubusercontent.com/06ca037f7a20ba25ef02f6c43e22bf6cf284c68710add6c931f20572505da82c/68747470733a2f2f696d672e736869656c64732e696f2f736f75726365666f7267652f646d2f70687062636c2e7376673f7374796c653d666f722d7468652d6261646765)](https://sourceforge.net/projects/phpbcl/files/latest/download)[![Download phpBCL](https://camo.githubusercontent.com/07ebd18ed442c9f5b1e38acccd6344b38330213122137c08825afe93490577d1/68747470733a2f2f696d672e736869656c64732e696f2f736f75726365666f7267652f64772f70687062636c2e7376673f7374796c653d666f722d7468652d6261646765)](https://sourceforge.net/projects/phpbcl/files/latest/download)[![Download phpBCL](https://camo.githubusercontent.com/12dd2519bdfb885b6f27034356489f57e2eaa30bbc76414c8d51efb423225ed6/68747470733a2f2f696d672e736869656c64732e696f2f736f75726365666f7267652f64642f70687062636c2e7376673f7374796c653d666f722d7468652d6261646765)](https://sourceforge.net/projects/phpbcl/files/latest/download)

---

Awards
------

[](#awards)

[![](https://camo.githubusercontent.com/d24866cb3cb40e8e2d2827344689c036ccf4bd7ef4bdff600363e4bd2098741b/68747470733a2f2f617070732e6173636f6f732e636f6d2f70687042434c2f696d616765732f504850434c41535345532d43657274696669636174652e706e67)](https://camo.githubusercontent.com/d24866cb3cb40e8e2d2827344689c036ccf4bd7ef4bdff600363e4bd2098741b/68747470733a2f2f617070732e6173636f6f732e636f6d2f70687042434c2f696d616765732f504850434c41535345532d43657274696669636174652e706e67)

---

Contributing
------------

[](#contributing)

This is an open source project, open to anyone.

Contributions are welcome [github](https://github.com/ascoos/phpbcl)

Feedback
--------

[](#feedback)

Please send any feedback or suggestions to [@ascoos](https://twitter.com/ascoos) (Twitter) or [create an issue](https://github.com/ascoos/phpbcl/issues) on GitHub.

License
-------

[](#license)

[![AGL-F](https://camo.githubusercontent.com/f0232a9787eecebb73a50c6d0eebe68c3dddd0c082804acd43aafcf4f5192528/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c6963656e73652d41474c462d626c75652e7376673f7374796c653d666f722d7468652d6261646765266c6162656c436f6c6f723d25323334653535356226636f6c6f723d303036343030)](http://docs.ascoos.com/lics/ascoos/AGL-F.html)

---

Download
--------

[](#download)

[![OFFICIAL ASCOOS DOWNLOAD SITE](https://camo.githubusercontent.com/8c49e6941d1282b798ae83816d28e95ec6a3c19f69d9b946424f4d32c9476ca3/68747470733a2f2f696d672e736869656c64732e696f2f776562736974653f75726c3d68747470733a2f2f646c2e6173636f6f732e636f6d2f7075622f70687042434c267374796c653d666f722d7468652d6261646765266c6162656c436f6c6f723d25323334653535356226636f6c6f723d303036343030)](https://dl.ascoos.com/pub/phpBCL/phpBCL-latest.zip)[![PHP Classes](https://camo.githubusercontent.com/066e48ced2dfbae77b14bde270c8480d1bc2e10e25ef5bdfc097c83904eba4df/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4769744875622d70687042434c2d626c75652e7376673f7374796c653d666f722d7468652d6261646765266c6162656c436f6c6f723d25323334653535356226636f6c6f723d383733323630)](https://github.com/ascoos/phpbcl/releases)[![PHP Classes](https://camo.githubusercontent.com/44c69cf50c45ce97de87b8210476b1fb0a14eff40e588bdbbca84c9689e88406/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7068702d636c61737365732d626c75652e7376673f7374796c653d666f722d7468652d6261646765266c6162656c436f6c6f723d25323334653535356226636f6c6f723d383733323630)](https://www.phpclasses.org/package/12926.html)[![Sourceforge phpBCL](https://camo.githubusercontent.com/eff800e5c0c95013e2a35f798ebc42bcd7948ea7357e3b067bf076e9009935ee/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f536f75726365466f7267652d70687042434c2d626c75652e7376673f7374796c653d666f722d7468652d6261646765266c6162656c436f6c6f723d25323334653535356226636f6c6f723d383733323630)](https://sourceforge.net/projects/phpbcl/files/latest/download)

---

Installation and use this library
=================================

[](#installation-and-use-this-library)

1. Download latest release
2. Unzip package in your working directory
3. Add in index.php or master php file the below code :

```
$path = '[YOUR SITE PATH]';
include $path . '/phpbcl/autoload.php';
```

---

- \[!\] = FIXED
- \[+\] = Added
- \[^\] = Updated
- \[-\] = Removed

Error FILE \[compat\_error.php\]
--------------------------------

[](#error-file--compat_errorphp)

This file contains support code for the remaining functions of the phpBCL library.

APHPphpBCLTYPENAMEDESCRIPTION+ALL1.0.8FILE`compat_error.php`To support errors for php &lt; 7+&lt; 7.2.01.0.8Class`Error`+&lt; 7.2.01.0.8Class`TypeError`+&lt; 8.0.01.0.8Class`ValueError`phpBCL FILE \[phpBCL.php\]
--------------------------

[](#phpbcl-file--phpbclphp)

This file contains support code for the remaining functions of the phpBCL library.

APHPphpBCLTYPENAMEDESCRIPTION+ALL1.0.5FILE`phpBCL.php`To support other functions in this php library+&gt;= 5.3.01.0.5Function`validate_encoding`Checks for any errors in the user's string encoding.+&gt;= 5.3.01.0.7Function`alf_preg_quote`Quote regular expression characters.DEPRECATED FILE \[compat\_deprecated.php\]
------------------------------------------

[](#deprecated-file--compat_deprecatedphp)

The use of the contents of the deprecated-removed code file is the reverse of the use of other files versioning-based on the php version.

This means that from the PHP version that refers and to newer versions, without the use of phpBCL and specifically the file `compat_deprecated.php`, you will not be able to use this code.

APHPphpBCLTYPENAMEDESCRIPTION+ALL1.0.0FILE`compat_deprecated.php`for deprecated-removed php functions+&gt;= 8.1.01.0.0CONST`ENT_COMPAT`ENT\_QUOTES+&gt;= 8.0.01.0.0CONST`MB_OVERLOAD_MAIL`= 1+&gt;= 8.0.01.0.0CONST`MB_OVERLOAD_STRING`= 2+&gt;= 8.0.01.0.0CONST`MB_OVERLOAD_REGEX`= 4+&gt;= 8.0.01.0.0Function`each`Return the current key and value pair from an array and advance the array cursor.VERSIONING FILES \[compat\_php43x.php - compat\_php86x.php\]
------------------------------------------------------------

[](#versioning-files--compat_php43xphp---compat_php86xphp)

The contents of version-based files mean that since added to a specific PHP version, without using `phpBCL`, you will not be able to use them in older versions.

> "All functions in the below table were tested on PHP 5.6"

APHPphpBCLTYPENAMEDESCRIPTION+&lt; 8.6.02.1.0Function`clamp`Returns the value clamped between min and max (nearest bound if out of range). Throws ValueError on invalid args (NAN, min &gt; max).+&lt; 8.5.02.0.4Function`array_first.php`Returns the first value of a given array.+&lt; 8.5.02.0.4Function`array_last.php`Returns the last value of a given array.+&lt; 8.5.02.0.4Function`locale_is_right_to_left.php`Returns whether the given $locale has an RTL script.+&lt; 8.5.02.0.4Function`get_error_handler.php`Returns the currently set error handler, or null if none is set.+&lt; 8.5.02.0.4Function`get_exception_handler.php`Returns the currently set exception handler, or null if is none set.+&lt; 8.5.02.0.0Constant`PHP_BUILD_DATE`that is assigned the time and date the PHP binary is built.+&lt; 8.4.01.1.4Function`intltz_get_iana_id`Get the IANA identifier from a given timezone+&lt; 8.4.01.1.2Function`bcdivmod`Returns an array with the quotient (whole values) as a string, and the remainder as a string containing $scale number of decimal values.+&lt; 8.4.01.1.1Function`grapheme_str_split`Splits a string into an array of individual or chunks of graphemes.+&lt; 8.4.01.1.1Function`array_find`Returns the VALUE of the first element from $array for which the $callback returns true. Returns NULL if no matching element is found.+&lt; 8.4.01.1.1Function`array_find_key`Returns the KEY of the first element from $array for which the $callback returns TRUE. If no matching element is found the function returns NULL.+&lt; 8.4.01.1.1Function`array_all`Checks whether the $callback returns TRUE for ALL the array elements.+&lt; 8.4.01.1.1Function`array_any`Checks whether the $callback returns TRUE for ANY of the array elements.+&lt; 8.4.01.1.0Function`http_get_last_response_headers`Get Last Response Headers+&lt; 8.4.01.1.0Function`http_clear_last_response_headers`Clear Last Response Headers^&lt; 8.4.01.0.7Function`mb_ltrim`Multi-byte safely strip white-spaces (or other characters) from the beginning of a string.^&lt; 8.4.01.0.7Function`mb_rtrim`Multi-byte safely strip white-spaces (or other characters) from the end of a string.^&lt; 8.4.01.0.7Function`mb_trim`Multi-byte safely strip white-spaces (or other characters) from the beginning and end of a string.^&lt; 8.4.01.0.5Function`mb_ucfirst`Make a multibyte string's first character uppercase.^&lt; 8.4.01.0.5Function`mb_lcfirst`Make a multibyte string's first character lowercase.^&lt; 8.3.02.0.4Function`mb_str_pad`The str\_pad() function lacks multibyte character support, causing issues when working with languages that utilize multibyte encodings like UTF-8.+&lt; 8.3.01.0.9Function`stream_context_set_options`Sets options on the specified context.+&lt; 8.3.01.0.0Function`json_validate`Validate an string if contains a valid json.+&lt; 8.2.01.0.9Function`openssl_cipher_key_length`Gets the cipher key length.+&lt; 8.2.01.0.8Function`ini_parse_quantity`Returns the interpreted size in bytes on success from an ini shorthand.^&lt; 8.2.01.0.8Function`mysqli_execute_query`Prepares, binds parameters, and executes SQL statement+&lt; 8.0.01.0.9Function`preg_last_error_msg`Returns the error message of the last PCRE regex execution.+&lt; 8.0.01.0.9Function`get_debug_type`Returns the resolved name of the PHP variable value.+&lt; 8.0.01.0.9Function`get_resource_id`Returns an integer identifier for the given resource+&lt; 8.0.01.0.9Function`fdiv`Divides two numbers, according to IEEE 754+&lt; 8.1.01.0.2Function`array_is_list`Checks whether a given array is a list^&lt; 8.0.01.0.2Interface`Stringable`The Stringable interface denotes a class as having a \_\_toString() method.^&lt; 8.0.01.0.2Class`PhpToken`This class provides an alternative to token\_get\_all(). While the function returns tokens either as a single-character string, or an array with a token ID, token text and line number, PhpToken::tokenize() normalizes all tokens into PhpToken objects, which makes code operating on tokens more memory efficient and readable.^&lt; 8.0.01.0.2Function`str_contains`Determine if a string contains a given substring^&lt; 8.0.01.0.2Function`str_ends_with`Checks if a string ends with a given substring^&lt; 8.0.01.0.2Function`str_starts_with`Checks if a string starts with a given substring+&lt; 7.4.01.0.0Function`password_algos`Get available password hashing algorithm IDs+&lt; 7.4.01.0.2Function`mb_str_split`Given a multibyte string, return an array of its characters+&lt; 7.3.01.0.2CONST`MB_CASE_FOLD`Performs a full case fold conversion which removes case distinctions present in the string. This is used for caseless matching. Used by `alf_mb_convert_case` (compat\_similar.php)+&lt; 7.3.01.0.2CONST`MB_CASE_UPPER_SIMPLE`Performs simple upper-case fold conversion. Used by `alf_mb_convert_case` (**compat\_similar.php**)+&lt; 7.3.01.0.2CONST`MB_CASE_LOWER_SIMPLE`Performs a simple lower-case fold conversion. Used by `alf_mb_convert_case` (**compat\_similar.php**)+&lt; 7.3.01.0.2CONST`MB_CASE_TITLE_SIMPLE`Performs simple title-case fold conversion. Used by `alf_mb_convert_case` (**compat\_similar.php**)+&lt; 7.3.01.0.2CONST`MB_CASE_FOLD_SIMPLE`Performs a simple case fold conversion which removes case distinctions present in the string. This is used for caseless matching. Used by `alf_mb_convert_case` (**compat\_similar.php**)^&lt; 7.3.01.0.2Function`array_key_first`Get the first key of the given array without affecting the internal array pointer.^&lt; 7.3.01.0.2Function`array_key_last`Get the last key of the given array without affecting the internal array pointer.+&lt; 7.3.01.0.1Function`is_countable`Verify that the contents of a variable is an array or an object implementing Countable+&lt; 7.1.01.0.1Function`is_iterable`Verify that the contents of a variable is an iterable value+&lt; 7.1.01.0.9Function`openssl_get_curve_names`Gets the list of available curve names+&lt; 7.0.01.0.9Function`intdiv`Integer division+&lt; 5.5.01.0.2Function`array_column`returns the values from a single column of the array, identified by the column\_key. Optionally, an index\_key may be provided to index the values in the returned array by the values from the index\_key column of the input array.+&lt; 5.5.01.0.2Function`boolval`Get the boolean value of a variable+&lt; 5.5.01.0.2Function`json_last_error_msg`Returns the error string of the last json\_encode() or json\_decode() call, which did not specify JSON\_THROW\_ON\_ERROR.+&lt; 4.3.01.0.2Function`mb_convert_case`Performs case folding on a string, converted in the way specified by mode.+&lt; 4.3.01.0.2CONST`MB_CASE_UPPER`Performs a full upper-case folding. Used by **`mb_convert_case`**+&lt; 4.3.01.0.2CONST`MB_CASE_LOWER`Performs a full lower-case folding. Used by **`mb_convert_case`**+&lt; 4.3.01.0.2CONST`MB_CASE_TITLE`Performs a full title-case conversion based on the Cased and CaseIgnorable derived Unicode properties. Used by **`mb_convert_case`**SIMILAR FILE \[compat\_similar.php\]
------------------------------------

[](#similar-file--compat_similarphp)

This file implements functions that resemble the original php functions that have not been removed, but have undergone changes and cannot run on all versions.

> "All similar functions start with prefix `alf_`"

APHPphpBCLTYPENAMEDESCRIPTION+&gt;= 8.3.01.0.9FILE`alf_get_class`Fixed E\_DEPRECATED warning+ALL1.0.1FILE`compat_similar.php`for similar functions+ALL1.0.2Function`alf_mb_convert_case`ASCOOS LIBRARY FUNCTION : For full compatible similar mb\_convert\_case.

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance78

Regular maintenance activity

Popularity0

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity34

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% 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 ~132 days

Total

3

Last Release

122d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/a0fd764155ac7d034ff39a7170a16b320bb0163887490c277d0b4e41495267fa?d=identicon)[ascoos](/maintainers/ascoos)

---

Top Contributors

[![ascoos](https://avatars.githubusercontent.com/u/4207994?v=4)](https://github.com/ascoos "ascoos (10 commits)")

---

Tags

ascoosascoos-osbackwardbackward-compatibilitycompatcompatibilitylibrariesphpphp-libraryphp-polyfillphp-polyfillsphp7php8phpbclpolyfillpolyfillscompatibilitypolyfillphppolyfillslibrariescompatPHP7php8PHP Librarybackward-compatibilitybackwardascoosascoos-frameworkphp-polyfillphp-polyfills

### Embed Badge

![Health badge](/badges/alexsoft-software-phpbcl/health.svg)

```
[![Health](https://phpackages.com/badges/alexsoft-software-phpbcl/health.svg)](https://phpackages.com/packages/alexsoft-software-phpbcl)
```

###  Alternatives

[symfony/polyfill-util

Symfony utilities for portability of PHP codes

1.3k123.9M7](/packages/symfony-polyfill-util)[symfony/polyfill

Symfony polyfills backporting features to lower PHP versions

2.8k4.5M24](/packages/symfony-polyfill)[symfony/polyfill-php82

Symfony polyfill backporting some PHP 8.2+ features to lower PHP versions

6640.8M72](/packages/symfony-polyfill-php82)[ducks-project/spl-types

Polyfill Module for SplType PHP extension. This extension aims at helping people making PHP a stronger typed language and can be a good alternative to scalar type hinting. It provides different typehandling classes as such as integer, float, bool, enum and string

1032.4k](/packages/ducks-project-spl-types)

PHPackages © 2026

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