baraja-core / service-method-invoker
Invoke method by service, name and arguments.
Installs: 229 412
Dependents: 4
Suggesters: 0
Security: 0
Stars: 2
Watchers: 2
Forks: 1
Open Issues: 0
Requires
- php: ^8.1
Requires (Dev)
- phpstan/extension-installer: ^1.1
- phpstan/phpstan: ^1.0
- phpstan/phpstan-deprecation-rules: ^1.0
- phpstan/phpstan-nette: ^1.0
- phpstan/phpstan-strict-rules: ^1.0
- roave/security-advisories: dev-master
- spaze/phpstan-disallowed-calls: ^2.0
- tracy/tracy: ^2.8
- dev-master
- v2.4.0
- v2.3.1
- v2.3.0
- v2.2.6
- v2.2.5
- v2.2.4
- v2.2.3
- v2.2.2
- v2.2.1
- v2.2.0
- v2.1.1
- v2.1.0
- v2.0.1
- v2.0.0
- v1.2.5
- v1.2.4
- v1.2.3
- v1.2.2
- v1.2.1
- v1.2.0
- v1.1.3
- v1.1.2
- v1.1.1
- v1.1.0
- v1.0.6
- v1.0.5
- v1.0.4
- v1.0.3
- v1.0.2
- v1.0.1
- v1.0.0
- dev-renovate/configure
- dev-restyled/renovate/configure
- dev-dependabot/add-v2-config-file
- dev-property-resolve-type
This package is auto-updated.
Last update: 2024-11-07 16:01:29 UTC
README
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.
📦 Installation & Basic Usage
This package can be installed using Package Manager which is also part of the Baraja Sandbox. If you are not using it, you will have to install the package manually using this guide.
No package configuration is required. Simply create an instance and the class is ready to use immediately.
To manually install the package call Composer and execute the following command:
$ composer require baraja-core/service-method-invoker
🗺️ Simple example
Think of a simple service as an API endpoint with a public method for hydrating your data:
$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; } }
📄 License
baraja-core/service-method-invoker
is licensed under the MIT license. See the LICENSE file for more details.