1. Go to this page and download the library: Download ac/fiendish-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/ */
ac / fiendish-bundle example snippets
namespace SomeRandomCoder\FoobarBundle\Daemon;
use AC\FiendishBundle\Daemon\BaseDaemon;
class UselessDaemon extends BaseDaemon
{
public function run($arg)
{
while(true) {
$this->heartbeat();
print("FOO " . $arg['phrase'] . "!\n");
sleep(1);
print("BAR " . $arg['phrase'] . "!\n");
sleep(1);
}
}
}
use SomeRandomCoder\FoobarBundle\Daemon\UselessDaemon;
$container = $this->getContainer();
$kernel = $container->get('kernel');
$group = $container->get('fiendish.groups.foobar');
$proc = $group->newProcess(
"useless_thing", // Name prefix, to help identify this process
UselessDaemon::toCommand($kernel), // The command to execute
["phrase" => "fries and a shake"] // The argument for run()
);
$procName = $proc->getProcName(); // Needed to access this Process later
$group->applyChanges(); // This call does not block
$container = $this->getContainer();
$group = $container->get('fiendish.groups.foobar');
$proc = $group->getProcess($procName); // This is the procName you got earlier...
$group->removeProcess($proc);
$group->applyChanges();
namespace JoeCoder\MyBundle\Daemon;
use AC\FiendishBundle\Daemon\ExternalDaemon;
class MyPythonAppDaemon extends ExternalDaemon
{
public function getExternalCommand()
{
return "@JoeCoderMyBundle/Resources/scripts/myapp.py";
}
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.