PHP code example of shapecode / cron-bundle
1. Go to this page and download the library: Download shapecode/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/ */
shapecode / 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\Attribute\AsCronJob;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
#[AsCronJob('*/5 * * * *')]
class DemoCommand extends Command
{
public function configure() : void
{
// Must have a name configured
// ...
}
public function execute(InputInterface $input, OutputInterface $output) : void
{
// Your code here
}
}