litvinab/cron-event
A lightweight Laravel package for defining and managing cron-based events. Schedule recurring tasks with cron expressions, attach custom event logic, and keep jobs organized alongside Laravel's scheduler for simpler automation.
Event (recurring) and Timer (one-off/delayed), plus cron:run and cron:list commands.config/database.php for the mongodb connection and ensure the package config points at it.cron:run, which is intended to be invoked every minute:* * * * * cd /path/to/app && php artisan cron:run >> /dev/null 2>&1
Event with a cron expression (for example, every five minutes), then run php artisan cron:list to confirm it is registered and php artisan cron:run manually to observe execution before wiring in real handlers.Event/Timer models or collections, and the cron:run/cron:list command classes.Event for recurring work expressed as a cron expression (reports, cleanups, sync jobs). Use Timer for one-shot or delayed execution; do not model recurring work as a Timer unless you re-create it after each run.cron:run. This keeps the every-minute command fast and prevents overlapping invocations.findOneAndUpdate-style locking, run cron:run on every node and let MongoDB arbitrate; otherwise designate a single runner or add an external lock.cron:list for inventory and spot checks, application logs for execution history, and a heartbeat/alert on “no successful run in N minutes.”php artisan cron:run manually, or invoke it from a wrapper scheduler process. Freeze time with Carbon::setTestNow() and use a dedicated test database to make schedule behavior deterministic.cron:run expects to be called every minute by system cron. Registering it inside Kernel::schedule() creates a confusing double-scheduling layer and makes timing harder to reason about.withoutOverlapping-style protection at the handler level if not.Timer is consumed on fire or persists. Design one-shot jobs so a missed or duplicate fire is tolerable, and clean up completed timers to prevent collection growth.cron:run into a collection scan. Create them during deployment, not after the first production incident.cron:list to confirm registration, run cron:run in the foreground to see output, and check the package's log channel. If nothing fires, verify the system cron entry, the PHP binary path, the working directory, and the MongoDB connection before suspecting the schedule expression.How can I help you explore Laravel packages today?