2017 © Pedro Peláez
 

library callback

Simple callback manager for PHP

image

txiki/callback

Simple callback manager for PHP

  • Sunday, March 1, 2015
  • by dieg0v
  • Repository
  • 1 Watchers
  • 1 Stars
  • 135 Installations
  • PHP
  • 2 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

Txiki Callback

Simple callback manager for PHP, (*1)

Author Latest Version Packagist Version, (*2)

Software License Build Status, (*3)

Install

Via Composer, (*4)

``` bash $ composer require txiki/callback, (*5)


## Requirements The following versions of PHP are supported by this version. * PHP 5.4 * PHP 5.5 * PHP 5.6 * HHVM ## Documentation Simple examples: ``` php require '../vendor/autoload.php'; use Txiki\Callback\Call; use Txiki\Callback\CallableObject; class DummyClass{ public function myMethod($foo, $bar) { return 'Out '.$foo.' - '.$bar; } } $cObject = new CallableObject( 'DummyClass::myMethod' , ['foor', 'bar']); // return 'Out foo - bar'; echo $result = Call::dispatch($cObject);
$a = 'extra';
$cObject = new CallableObject(
    function($foo, $bar) use ($a) {
        return 'Out '.$foo.' - '.$bar.' - '.$a;
    } ,
    ['foor', 'bar']
);

// return 'Out foor - bar - extra';
echo $result = Call::dispatch($cObject);



Implements ICallable interface to convert your own object on a CallableObject: ```php use Txiki\Callback\ICallable; class MyObject implements ICallable { public function myMethod() { } public function getCallable() { return function($id){ echo 'ok '.$id; }; } public function getParams() { return [999]; } } // return 'ok 999' echo Call::dispatch(new MyObject());
## Testing ``` bash $ vendor/bin/phpunit

Contributing

Please see CONTRIBUTING for details., (*6)

Credits

License

The MIT License (MIT). Please see License File for more information., (*7)

The Versions

01/03 2015

dev-master

9999999-dev https://github.com/dieg0v/txiki-callback

Simple callback manager for PHP

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

The Development Requires

callback txiki

26/02 2015

0.1.0

0.1.0.0 https://github.com/dieg0v/txiki-callback

Simple callback manager for PHP

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

The Development Requires

callback txiki