baraja-core/service-method-invoker

There is no license information available for the latest version (v1.0.4) of this package.

Invoke method by service, name and arguments.

v1.0.4 2020-06-25 15:08 UTC

This package is auto-updated.

Last update: 2020-07-25 15:19:08 UTC


README

Integrity check

Imagine you have instance of your custom service and you want invoke some action method with sets of parameters.

This package is simply way how to invoke all your methods.

Simple example:

$invoker = new \Baraja\ServiceMethodInvoker;

$apiEndpoint = new \Baraja\MyApiEndpoint;

$data = $invoker->invoke($apiEndpoint, 'actionDetail', ['id' => 42]);

var_dump($data); // return "My id is: 42"

And your endpoint can be:

class MyApiEndpoint
{
    public function actionDetail(int $id): string
    {
        return 'My id is: ' . $id;
    }
}