PHP code example of zenaton / zenaton-laravel

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

    

zenaton / zenaton-laravel example snippets


namespace App\Zenaton\Tasks;

use Zenaton\Interfaces\TaskInterface;
use Zenaton\Traits\Zenatonable;

class HelloWorldTask implements TaskInterface
{
    use Zenatonable;
    
    public function handle()
    {
        echo "Hello World\n";

        return mt_rand(0, 1);
    }
}

(new \App\Zenaton\Tasks\HelloWorldTask())->dispatch();

namespace App\Zenaton\Workflows;

use Zenaton\Interfaces\WorkflowInterface;
use Zenaton\Traits\Zenatonable;

class MyFirstWorkflow implements WorkflowInterface
{
    use Zenatonable;

    public function handle()
    {
        $n = (new HelloWorldTask())->execute();
        if ($n > 0) {
            (new FinalTask())->execute();
        }
    }
}

(new \App\Zenaton\Workflows\MyFirstWorkflow())->dispatch();
ini
ZENATON_APP_ID=YourAppId
ZENATON_API_TOKEN=YourApiToken
ZENATON_APP_ENV=dev
sh
php artisan vendor:publish --tag=zenaton-config
sh
php artisan zenaton:make:task HelloWorldTask
sh
php artisan zenaton:make:workflow MyFirstWorkflow