PHP code example of luiswagener / symfony-cron-bundle
1. Go to this page and download the library: Download luiswagener/symfony-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/ */
luiswagener / symfony-cron-bundle example snippets
use Luiswagener\SymfonyCronBundle\Attribute\AsCronJob;
#[AsCronJob('hourly')]
final class CleanupExpiredTokensCron
{
public function __construct(private TokenRepository $tokens) {}
public function __invoke(): void
{
$this->tokens->deleteExpired();
}
}
use Luiswagener\SymfonyCronBundle\Exception\CronExecutionSkippedException;
public function __invoke(string $scope): void
{
if ($scope !== Cron::SCOPE_CLI) {
throw new CronExecutionSkippedException();
}
}