PHP code example of gemorroj / cron-bundle
1. Go to this page and download the library: Download gemorroj/cron-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/ */
gemorroj / cron-bundle example snippets
// config/bundles.php
return [
// ...
Shapecode\Bundle\CronBundle\ShapecodeCronBundle::class,
// ...
];
declare(strict_types=1);
namespace App\DemoBundle\Command;
use Shapecode\Bundle\CronBundle\Annotation\CronJob;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
/**
* @CronJob("*\/5 * * * *")
* Will be executed every 5 minutes
*/
class DemoCommand extends Command
{
public function configure() : void
{
// Must have a name configured
// ...
}
public function execute(InputInterface $input, OutputInterface $output) : void
{
// Your code here
}
}