PHP code example of stoyantodorov / resolve-utilities

1. Go to this page and download the library: Download stoyantodorov/resolve-utilities library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

stoyantodorov / resolve-utilities example snippets


public function useUtility(string $abstract, array $input): mixed

abstract public function execute(): self

use StoyanTodorov\ResolveUtilities\Utility;

class StringOutputExample extends Utility
{
    protected string $output;

    protected string|null $propOne = null;
    protected int|null $propTwo = null;
    
    protected array $

$resolver = new StoyanTodorov\ResolveUtilities\Resolver;
$resultOne = $resolver->useUtility(StringOutputExample::class, ['propOne' => 'test']);
$resultTwo = $resolver->useUtility(StringOutputExample::class, ['propOne' => 'test', 'propTwo' => 100]);

use StoyanTodorov\ResolveUtilities\HasResolver;

class ExampleClient 
{
    use HasResolver;
    
    public function test(string $propOne): string
    {
        return $this->useUtility(StringOutputExample::class, compact('propOne'));
    }
}
$result = (new ExampleClient)->test('test');