2017 © Pedro Peláez
 

library callbacks

Extension of php-callback format

image

axy/callbacks

Extension of php-callback format

  • Monday, January 8, 2018
  • by axy
  • Repository
  • 2 Watchers
  • 1 Stars
  • 337 Installations
  • PHP
  • 4 Dependents
  • 0 Suggesters
  • 0 Forks
  • 1 Open issues
  • 7 Versions
  • 0 % Grown

The README.md

axy\callbacks: the callback extended format

Latest Stable Version Minimum PHP Version Build Status Coverage Status License, (*1)

  • The library does not require any dependencies.
  • Tested on PHP 5.4+, PHP 7, HHVM (on Linux), PHP 5.5 (on Windows).
  • Install: composer require axy/callbacks.
  • License: MIT.

Documentation

Examples

function sum($a, $b)
{
    return $a + $b;
}

Standard callback:, (*2)

$callback = new Callback('sum');

echo $callback(2, 2);

Binging arguments:, (*3)

$callback = new Callback('sum', [3]);

echo $callback(4); // 3 + 4 = 7

Binging context:, (*4)

class MyClass
{
    public function getEventHandler()
    {
        return new Callback([$this, 'onEvent'], ['click'], true);
    }

    private function onEvent($event)
    {
        echo 'Event '.$event.'!';
    }
}

$obj = new MyClass();
$handler = $obj->getEventHandler();

// click
$handler(); // "Event click!". Private method was called

The Versions

08/01 2018

dev-master

9999999-dev https://github.com/axypro/callbacks

Extension of php-callback format

  Sources   Download

MIT

The Requires

 

callback call_user_func

10/11 2015

1.0.3

1.0.3.0 https://github.com/axypro/callbacks

Extension of php-callback format

  Sources   Download

MIT

The Requires

 

callback call_user_func

31/03 2015

1.0.2

1.0.2.0 https://github.com/axypro/callbacks

Extension of php-callback format

  Sources   Download

MIT

The Requires

 

callback call_user_func

09/02 2015

1.0.1

1.0.1.0 https://github.com/axypro/callbacks

Extension of php-callback format

  Sources   Download

MIT

The Requires

 

callback call_user_func

04/01 2015

1.0.0

1.0.0.0 https://github.com/axypro/callbacks

Extension of php-callback format

  Sources   Download

MIT

The Requires

 

callback call_user_func

24/01 2014

0.0.2

0.0.2.0 https://github.com/axypro/callbacks

Extension of php-callback format

  Sources   Download

MIT

The Requires

 

callback

26/12 2013

0.0.1

0.0.1.0 https://github.com/axypro/callbacks

Extension of php-callback format

  Sources   Download

MIT

The Requires

 

callback