PHP code example of dubture / async-bundle

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

    

dubture / async-bundle example snippets


// app/AppKernel.php

public function registerBundles()
{
    $bundles = array(

        // register the async bundle
        new Dubture\AsyncBundle\DubtureAsyncBundle(),

        // register the dependencies of the async bundle
        new JMS\DiExtraBundle\JMSDiExtraBundle($this),
        new JMS\AopBundle\JMSAopBundle(),

        // your application bundles here...

    );

    return $bundles;
}


class MediaTranscodingService
{
    public function transcodeFile($sourcePath)
    {
            // ... do some heavy-lifting, e.g. media transcoding
    }
}


use Dubture\AsyncBundle\Annotation\Async;

class MediaTranscodingService
{
    /**
     * @Async
     */
    public function transcodeFile($sourcePath)
    {
            // ... do some heavy-lifting, e.g. media transcoding
    }
}