PHPackages                             fleshgrinder/stringable - 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. fleshgrinder/stringable

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

fleshgrinder/stringable
=======================

Interface for easy identification of classes that implement the magic \_\_toString method.

v0.1.0(10y ago)171911MITPHP

Since Sep 22Pushed 8y agoCompare

[ Source](https://github.com/Fleshgrinder/php-stringable)[ Packagist](https://packagist.org/packages/fleshgrinder/stringable)[ RSS](/packages/fleshgrinder-stringable/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (4)Used By (1)

[![Packagist](https://camo.githubusercontent.com/81ec566009ee703414077057882fc8e08dd77136e4ba0b8a68d2f9e47150edb3/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f466c6573686772696e6465722f737472696e6761626c652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/fleshgrinder/stringable)[![Packagist License](https://camo.githubusercontent.com/cb5f8d6948e06a2ac143afe3488dcc519ab8a030385c5b5e89c12b1a7a62b7f5/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f466c6573686772696e6465722f737472696e6761626c652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/fleshgrinder/stringable)

Stringable
==========

[](#stringable)

Interface for easy identification of classes that implement PHP’s magic [`__toString`](https://secure.php.net/language.oop5.magic#object.tostring) method.

Provided is the interface itself that establishes the contract that implementing classes have to have the magic method. As well as a dummy class that can be used in tests as a substitute for doubles, stubs, or mocks.

Installation
------------

[](#installation)

Open a terminal, enter your project directory and execute the following command to add this package to your dependencies:

```
$ composer require fleshgrinder/stringable
```

This command requires you to have Composer installed globally, as explained in the [installation chapter](https://getcomposer.org/doc/00-intro.md) of the Composer documentation.

Usage
-----

[](#usage)

> **IMPORTANT**
> You cannot throw any exceptions in a `__toSring` method due to Zend engine limitations. Please vote and comment on the [this PHP request](https://bugs.php.net/bug.php?id=53648) and lets hope this will be fixed.

Simply implement the interface and PHP’s magic `__toString` method.

```
class YourClass implements Stringable {

    /**
     * @inheritDoc
     */
    public function __toString() {
        return '';
    }

}
```

License
-------

[](#license)

[![MIT License](https://camo.githubusercontent.com/f8370bd5022685ccc4cdebd136a849a7692c5afd674e59ca8805d90f2aa29a72/68747470733a2f2f75706c6f61642e77696b696d656469612e6f72672f77696b6970656469612f636f6d6d6f6e732f7468756d622f632f63332f4c6963656e73655f69636f6e2d6d69742e7376672f343870782d4c6963656e73655f69636f6e2d6d69742e7376672e706e67)](https://opensource.org/licenses/MIT)

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity16

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity55

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

Every ~3 days

Total

3

Last Release

3886d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/6680298143064cd3ac63c0097ef724d46f47221ae0990db445081c4e8a923e05?d=identicon)[Fleshgrinder](/maintainers/Fleshgrinder)

---

Top Contributors

[![Fleshgrinder](https://avatars.githubusercontent.com/u/1059453?v=4)](https://github.com/Fleshgrinder "Fleshgrinder (6 commits)")

### Embed Badge

![Health badge](/badges/fleshgrinder-stringable/health.svg)

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

PHPackages © 2026

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