1. Go to this page and download the library: Download fdevs/cron-bridge 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/ */
fdevs / cron-bridge example snippets
// app/AppKernel.php
public function registerBundles()
{
$bundles = array(
// ...
new FDevs\Bridge\Cron\FDevsCronBundle(),
// ...
);
}
#!/usr/bin/env php
// application.php
;
use FDevs\Bridge\Cron\Command\DumpCommand;
use FDevs\Bridge\Cron\Command\ReplaceCommand;
use FDevs\Cron\Cron;
use FDevs\Cron\CrontabUpdater;
use Symfony\Component\Console\Application;
$cron = new Cron()
// $cron configuration...
$crontabUpdater = new CrontabUpdater('uniquie_key');
$application = new Application();
$application->add(new ReplaceCommand('cron:replace', $cron, $crontabUpdater));
$application->add(new DumpCommand('cron:dump', $cron));
$application->add(new DeleteCommand('cron:delete', $crontabUpdater));
$application->run();
use Symfony\Component\DependencyInjection\ContainerBuilder;
use FDevs\Bridge\Cron\DependencyInjection\FDevsCronExtension;
use FDevs\Bridge\Cron\DependencyInjection\Compiler\CronJobPass;
$container = new ContainerBuilder();
// $container configuration...
$container->registerExtension(FDevsCronExtension());
$container->addCompilerPass(new CronJobPass());
$updater = $container->get('f_devs_cron.crontab_updater');
$cron = $container->get('f_devs_cron.cron');
$updater->replace($cron);
echo strval($cron);