1. Go to this page and download the library: Download lemax10/simple-actions 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/ */
lemax10 / simple-actions example snippets
declare(strict_types=1);
namespace Example/Actions;
use LeMaX10\SimpleActions\Action;
/**
* @method ExampleModel run(int $id)
*/
final class ExampleAction extends Action
{
protected function handle(int $id): ExampleModel
{
return ExampleModel::findOrFail($id);
}
}
var_dump(ExampleAction::make()->run(1)); // (ExampleModel)