2017 © Pedro Peláez
 

library stringable

Interface for easy identification of classes that implement the magic __toString method.

image

fleshgrinder/stringable

Interface for easy identification of classes that implement the magic __toString method.

  • Sunday, September 27, 2015
  • by Fleshgrinder
  • Repository
  • 1 Watchers
  • 1 Stars
  • 113 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 4 Versions
  • 2 % Grown

The README.md

Packagist Packagist License, (*1)

Stringable

Interface for easy identification of classes that implement PHP’s magic __toString method., (*2)

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., (*3)

Installation

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

$ composer require fleshgrinder/stringable

This command requires you to have Composer installed globally, as explained in the installation chapter of the Composer documentation., (*5)

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 and lets hope this will be fixed., (*6)

Simply implement the interface and PHP’s magic __toString method., (*7)

class YourClass implements Stringable {

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

}

License

MIT License, (*8)

The Versions

27/09 2015

dev-master

9999999-dev

Interface for easy identification of classes that implement the magic __toString method.

  Sources   Download

MIT

27/09 2015

v0.1.0

0.1.0.0

Interface for easy identification of classes that implement the magic __toString method.

  Sources   Download

MIT

22/09 2015

v0.0.1

0.0.1.0

Interface for easy identification of classes that implement the magic __toString method.

  Sources   Download

MIT

22/09 2015

v0.0.0

0.0.0.0

Interface for easy identification of classes that implement the magic __toString method.

  Sources   Download

MIT