2017 © Pedro Peláez
 

library callableresolver

PHP callable resolver

image

isholao/callableresolver

PHP callable resolver

  • Tuesday, November 21, 2017
  • by isholao
  • Repository
  • 0 Watchers
  • 0 Stars
  • 38 Installations
  • PHP
  • 2 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

Build Status, (*1)

Install

To install with composer:, (*2)

composer require isholao/callableresolver

Requires PHP 7.1 or newer., (*3)

Usage

Here's a basic usage example:, (*4)

<?php

require '/path/to/vendor/autoload.php';

class Dummy {
    function methodToCall(){
        return 'methodToCall';
    }
}

$resolver = new \Isholao\CallableResolver\Resolver();
$resolved = $resolver->resolve(Dummy::class.'->methodToCall'); 

\\or

$resolved = $resolver->resolve(function(){
    return 'methodToCall';
});

$resolved(); // 'methodToCall'

The library provides a helper useful for using a valid PHP string to call the class for example 'Class->method', (*5)

<?php

require '/path/to/vendor/autoload.php';

class Dummy {
    function methodToCall($name){
        return $name;
    }
}

$dc = new \Isholao\CallableResolver\DeferredCallable(Dummy::class.'->methodToCall');
$dc('methodToCall'); // 'methodToCall'

//or

$dc = new \Isholao\CallableResolver\DeferredCallable(Dummy::class.'->methodToCall', new \CallableResolver\Resolver());
$dc('methodToCall'); // 'methodToCall'

The Versions

21/11 2017

1.x-dev

1.9999999.9999999.9999999-dev https://github.com/isholao/callableresolver

PHP callable resolver

  Sources   Download

BSD-3-Clause

The Requires

  • php >=7.1.0

 

The Development Requires

by Ishola O

callable callableresolver

21/11 2017

1.0

1.0.0.0 https://github.com/isholao/callableresolver

PHP callable resolver

  Sources   Download

BSD-3-Clause

The Requires

  • php >=7.1.0

 

The Development Requires

by Ishola O

callable callableresolver