Download the PHP package stoyantodorov/resolve-utilities without Composer
On this page you can find all versions of the php package stoyantodorov/resolve-utilities. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download stoyantodorov/resolve-utilities
More information about stoyantodorov/resolve-utilities
Files in stoyantodorov/resolve-utilities
Package resolve-utilities
Short Description Laravel Package
License MIT
Homepage https://github.com/stoyantodorov/resolve-utilities
Informations about the package resolve-utilities
resolve-utilities
This package offers a way to instantiate a class, to send typed input to it and to receive typed result using a convenient interface:
That is implemented by Resolver
class. It takes care to there are no duplicated instances and resets input/output in them before using.
The instantiated class should extend StoyanTodorov\ResolveUtilities\Utility
- so it is obliged to implement method execute
:
Тhe data sent to useUtility
through array $input
is available as class properties in the instance. The output, that we expect, should be set in output
property. In this way we may rely on typed input and output without binding the executed code to a certain interface.
Requirements
-
PHP 8.1
Laravel
Installation
Usage
Extend Utility
- In
requiredInput
add the properties names whichexecute
uses. - In
defaultInput
add the properties names with theirs default values. WhenuseUtility
method is called these values are used unless they aren't added to the second parameter.
Resolver
- The first parameter sent to
useUtility
may also be an abstract definition like'single-output-example'
. It will be instantiated if there is such definition inLaravel
Service Container
HasResolver
Testing
Changelog
Please see CHANGELOG for more information on what has changed recently.
License
The MIT License (MIT). Please see License File for more information.