PHP code example of returnearly / actions-pattern

1. Go to this page and download the library: Download returnearly/actions-pattern 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/ */

    

returnearly / actions-pattern example snippets


\App\Actions\MyCustomAction::make()->handle($item)

use App\Actions\MyCustomAction;

class MyController
{
    public function __construct(
        private MyCustomAction $action
    ){
    }

    public function __invoke($item)
    {
        $this->action->handle($item);
    }
}