PHP code example of splash / tasking-bundle

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

    

splash / tasking-bundle example snippets


// app/AppKernel.php

public function registerBundles()
{
    return array(
        // ...
        new Splash\Tasking\SplashTaskingBundle(),
        // ...
    );
}

use Splash\Tasking\Model\AbstractJob;

class MyJob extends AbstractJob
{
    /** @return bool */
    public function execute() : bool
    {
        // Execute your background operations
        // ...
        return true;
    }
}

use Splash\Tasking\Model\AbstractJob;

class MyJob extends AbstractJob
{
    /** You can set it directly by overriding this constant */
    protected $token = "";

    /**
     * Or by writing an array of parameters to setToken()
     * @param array $parameters 
     * @return self
     */
    public function setup(array $parameters): self
    {
        //====================================================================//
        // Setup Job Token
        $this->setToken($parameters);

        return $this;
    }
}
bash
docker-compose exec app php vendor/bin/phpunit 
bash
docker-compose exec app php vendor/bin/grumphp run