1. Go to this page and download the library: Download treehouselabs/worker-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/ */
treehouselabs / worker-bundle example snippets
# app/AppKernel.php
class AppKernel extends Kernel
{
public function registerBundles()
{
$bundles = [
// ...
new TreeHouse\WorkerBundle\TreeHouseWorkerBundle(),
];
// ...
}
// ...
}
# src/AppBundle/Executor/HelloWorldExecutor.php
use TreeHouse\WorkerBundle\Executor\AbstractExecutor;
class HelloWorldExecutor extends AbstractExecutor
{
public function getName()
{
return 'hello.world';
}
public function configurePayload(OptionsResolver $resolver)
{
$resolver->setRequired(0);
}
public function execute(array $payload)
{
$name = array_shift($payload);
# process stuff here, in this example we just print something
echo 'Hello, ' . $name;
return true;
}
}