php-extended / polyfill-php80-stringable
A polyfill that adds the stringable interface added in php8.0 to previous versions of php
Requires
- php: >=7.0
- dev-master
- 1.2.12
- 1.2.11
- 1.2.10
- 1.2.9
- 1.2.8
- 1.2.7
- 1.2.6
- 1.2.5
- 1.2.4
- 1.2.3
- 1.2.2
- 1.2.1
- 1.2.0
- 1.1.1
- 1.1.0
- 1.0.41
- 1.0.40
- 1.0.39
- 1.0.38
- 1.0.37
- 1.0.36
- 1.0.35
- 1.0.34
- 1.0.33
- 1.0.32
- 1.0.31
- 1.0.30
- 1.0.29
- 1.0.28
- 1.0.27
- 1.0.26
- 1.0.25
- 1.0.24
- 1.0.23
- 1.0.22
- 1.0.21
- 1.0.20
- 1.0.19
- 1.0.18
- 1.0.17
- 1.0.16
- 1.0.15
- 1.0.14
- 1.0.13
- 1.0.12
- 1.0.11
- 1.0.10
- 1.0.9
- 1.0.8
- 1.0.7
- 1.0.6
- 1.0.5
- 1.0.4
- 1.0.3
- 1.0.2
- 1.0.1
- 1.0.0
This package is auto-updated.
Last update: 2024-12-01 00:07:15 UTC
README
A polyfill that adds the stringable interface added in php8.0 to previous versions of php.
Installation
The installation of this library is made via composer and the autoloading of all classes of this library is made through their autoloader.
- Download
composer.phar
from their website. - Then run the following command to install this library as dependency :
php composer.phar install php-extended/polyfill-php80-stringable ^1
Motivation
There are a number of implementations of the \Stringable
interface introduced
by the rfc into php8.0, but none of them actually fit my needs. Those are:
- strict standard implementation that follows the rfc proposal ;
- transparent replacement for when the php version is upped to php8 withtout the need to redefine dependancy constraints for packages that depends on this one ;
- backward compatibility up to php7.0
First, there is the symfony implementation. But by compatibility with php5, that implementation does not strictly follows the implementation described into the rfc (missing return type).
Then, there is the raigu implementation but that implementation allows exceptions to be thrown (which is a behavior that is allowed by php7.4 and php8). I need to have this interface available for lower versions of php7 and given the restriction on package versions, that implementation is unavailable.
Then, there is the fleshgrinder implementation. That implementation does not follow the rfc and is in its own namespace, which do not permit for transparent replacement when the php version of any program is upped to the php8 version.
There may be others implementations available that are not listed there.
License
MIT (See license file).