PHP code example of tina4components / tina4jobsmodule

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

    

tina4components / tina4jobsmodule example snippets




namespace Tina4Jobs;

use Tina4Jobs\Tina4Job;

class TestJob implements Tina4Job
{
    use Tina4Queueable; // This is a trait that is used to make the job queueable

    private $user;

    public function __construct($payload = [])
    {
        $this->user = ["name" => "John", "surname" => "Doe",
            ...$payload];
    }

    public function handle(): void
    {
        file_put_contents("test.txt", json_encode($this->user) . "\n\n", FILE_APPEND);
    }
}

\Tina4Jobs\Tina4JobQueue::push((new \Tina4Jobs\TestJob(
    [
        "surname" => "Smith", 
        "age" => 30, 
        "country" => "South Africa"
    ]
), "queue_name");