PHPackages                             raigu/php80-stringable-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. raigu/php80-stringable-polyfill

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

raigu/php80-stringable-polyfill
===============================

Polyfill to backport PHP8.0 Stringable feature to lower PHP versions

v1.0.0(6y ago)0237MITPHPPHP &gt;=7.4.0

Since Apr 19Pushed 6y ago1 watchersCompare

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

READMEChangelogDependenciesVersions (2)Used By (0)

[![Latest Stable Version](https://camo.githubusercontent.com/19d14c792129984509d183db8cd4d4329933031510d60cedf7ea3654fb39e6ec/68747470733a2f2f706f7365722e707567782e6f72672f72616967752f70687038302d737472696e6761626c652d706f6c7966696c6c2f762f737461626c65)](https://packagist.org/packages/raigu/php80-stringable-polyfill)[![GitHub license](https://camo.githubusercontent.com/445cbbf98385aba42e6d309a55ebbd99afed2142d7e04a05359a5adac753916b/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f72616967752f70687038302d737472696e6761626c652d706f6c7966696c6c)](LICENSE.md)

Plyfill of Stringable interface of PHP8.0 to PHP7.4+
====================================================

[](#plyfill-of-stringable-interface-of-php80-to-php74)

Allows to use [Stringable interface](https://wiki.php.net/rfc/stringable), which will be in PHP8.0, in PHP7.4+.

Motivation
==========

[](#motivation)

Current polyfill in [sympfony/polyfill](https://github.com/symfony/polyfill) did not meet my needs.

First it did not follow explicitly the same interface signature ([link](https://github.com/symfony/polyfill/blob/master/src/Php80/Resources/stubs/Stringable.php)) as in [proposal](https://wiki.php.net/rfc/stringable#proposal) (return type missing).

Secondly I discovered from [\_\_toString](https://www.php.net/manual/en/language.oop5.magic.php#object.tostring) documentation that it was not possible to throw an exception from within a \_\_toString() method before PHP 7.4.0. Doing so will result in a fatal error. The symphony/polyfill does not warn about it and allows to use polyfill starting from PHP 7.0.8. This package is explicit about this restriction in composer.json thus avoiding misuse.

Install
=======

[](#install)

```
$ composer require raigu/php80-stringable-polyfill
```

License
=======

[](#license)

This project is licensed under the [MIT license](LICENSE.md)

Acknowledgments
===============

[](#acknowledgments)

I would like to thank Guilliam Xavier for [posting](https://externals.io/message/108214#108475) alternative names to Stringable interface. Although his recommendations where not accepted Google picked up the keywords. I was solving the same problem and where checking up my name candidates when I stumbled to Guilliam's post. Instead of continuing my own now I can create future compatible solutions that are easier to justify.

###  Health Score

26

—

LowBetter than 41% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity11

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity56

Maturing project, gaining track record

 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

Unknown

Total

1

Last Release

2255d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/82bf3ac844b3984ae4f9965188829da1729ca1e86abd92151406d15896c021b9?d=identicon)[raigu](/maintainers/raigu)

---

Top Contributors

[![raigu](https://avatars.githubusercontent.com/u/3442567?v=4)](https://github.com/raigu "raigu (3 commits)")

---

Tags

compatibilityportablepolyfillstringable

### Embed Badge

![Health badge](/badges/raigu-php80-stringable-polyfill/health.svg)

```
[![Health](https://phpackages.com/badges/raigu-php80-stringable-polyfill/health.svg)](https://phpackages.com/packages/raigu-php80-stringable-polyfill)
```

###  Alternatives

[symfony/polyfill-mbstring

Symfony polyfill for the Mbstring extension

7.8k1.2B687](/packages/symfony-polyfill-mbstring)[symfony/polyfill-ctype

Symfony polyfill for ctype functions

4.0k1.0B178](/packages/symfony-polyfill-ctype)[symfony/polyfill-php72

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

4.7k684.0M35](/packages/symfony-polyfill-php72)[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)[symfony/polyfill-intl-normalizer

Symfony polyfill for intl's Normalizer class and related functions

2.1k866.4M60](/packages/symfony-polyfill-intl-normalizer)[symfony/polyfill-php73

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

2.4k595.3M79](/packages/symfony-polyfill-php73)

PHPackages © 2026

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