2017 © Pedro Peláez
 

library magic-interfaces

Provides PHP Interfaces to test some magic methods using instanceof instead of method_exists

image

lightningspirit/magic-interfaces

Provides PHP Interfaces to test some magic methods using instanceof instead of method_exists

  • Tuesday, December 16, 2014
  • by lightningspirit
  • Repository
  • 1 Watchers
  • 0 Stars
  • 17 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 4 Versions
  • 0 % Grown

The README.md

Latest Stable Version Build Status License ![Gitter](https://badges.gitter.im/Join Chat.svg), (*1)

PHP Interfaces for magic methods

This package provides interfaces that define PHP magic methods., (*2)

Using interfaces to test for existing implementations is often recognized as a best practice., (*3)

When testing objects for magic methods implementation, those interfaces can be useful., (*4)

Motivation

Instead of:, (*5)

if (method_exists('__invoke', $object)) {
    $object();
}

one can now write:, (*6)

if ($object instanceof Invokable) {
    $object();
}

Usage example

Create a class that implements some magic interfaces., (*7)

/**
 * Implement some magic methods by using interfaces
 */
class Example implements Invokable, Stringifiable {

}

The Versions

16/12 2014

dev-master

9999999-dev http://www.github.com/lightningspirit/magic-interfaces

Provides PHP Interfaces to test some magic methods using instanceof instead of method_exists

  Sources   Download

MIT

The Requires

  • php >=5.3.1

 

The Development Requires

interfaces magic methods magic interfaces

16/12 2014

1.1.0

1.1.0.0 http://www.github.com/lightningspirit/magic-interfaces

Provides PHP Interfaces to test some magic methods using instanceof instead of method_exists

  Sources   Download

MIT

The Requires

  • php >=5.3.1

 

The Development Requires

interfaces magic methods magic interfaces

16/12 2014

dev-develop

dev-develop http://www.github.com/lightningspirit/magic-interfaces

Provides PHP Interfaces to test some magic methods using instanceof instead of method_exists

  Sources   Download

MIT

The Requires

  • php >=5.3.1

 

The Development Requires

interfaces magic methods magic interfaces

14/12 2014

1.0.1

1.0.1.0 http://www.github.com/lightningspirit/magic-interfaces

Provides PHP Interfaces to test some magic methods using instanceof instead of method_exists

  Sources   Download

MIT

The Requires

  • php >=5.3.1

 

The Development Requires

interfaces magic methods magic interfaces