- What is m-h-1/cron-bundle used for in Laravel?
- It is a PHP package for parsing, validating, and evaluating cron expressions and scheduled jobs in Laravel applications. It helps define recurring task timing in one place so your app can decide when jobs should run without hand-written date logic. It fits apps that use system cron to trigger Laravel jobs and need centralized schedule definitions.
- How do I install m-h-1/cron-bundle with Composer?
- Install it via Composer using the package name m-h-1/cron-bundle, then follow the repository's configuration instructions for your Laravel app. Pin v1.3.0 in staging first if you are upgrading, because the lock behavior changed. Check the README and release notes for any service provider or config publishing steps.
- Does Cron Bundle replace Laravel's scheduler?
- No, it is best treated as a complement to Laravel's native scheduler rather than a replacement. Laravel's scheduler handles task definitions and the schedule:run entry point, while Cron Bundle focuses on parsing, validating, and evaluating cron expressions and job timing. Keep clear ownership of which system defines cron entries to avoid duplicate or conflicting schedules.
- How does locking work in Cron Bundle v1.3.0?
- Version 1.3.0 changed from a trait-based locking approach to direct use of a lock component. This can affect concurrency behavior, lock ownership, TTL, stale-lock handling, and any code that extended or imported the removed trait. Validate overlapping jobs, crash scenarios, and long-running tasks in staging before production.
- Can Cron Bundle prevent overlapping jobs across multiple servers?
- It can only coordinate across hosts if the lock component is backed by a shared lock store that every cron host can reach. Local-only locks will not prevent cross-host overlap. Confirm your lock backend and deployment topology, especially in containers or scaled worker environments.
- How do I configure a custom PHP path in Cron Bundle?
- Version 1.3.0 adds a configurable custom PHP path for environments where the default php binary is not correct, such as containers, shared hosts, or version-managed runtimes. Set it only where needed and make sure the path exists consistently on every host or container. Test cron invocation failures and config-cache behavior in staging before rolling out.
- Which Laravel and PHP versions are supported by m-h-1/cron-bundle?
- The provided context does not list exact Laravel or PHP version constraints, so check the package's composer.json, README, and release notes before upgrading. Verify supported PHP and Laravel versions, lock component constraints, and config-cache behavior for your environment. Treat undocumented constraints as a validation item in staging.
- Is upgrading to v1.3.0 a breaking change?
- No explicit breaking change is declared, but replacing a trait with a lock component can alter concurrency behavior and may break consumers that relied on the trait directly. The custom PHP path also needs validation to avoid command failures. Pin v1.3.0 in a non-production environment and keep v1.2.0 as a rollback until lock behavior is confirmed.
- How should I test cron expression evaluation and scheduled jobs?
- Test parsing, validation, and evaluation against fixed date/time values so results are deterministic. Exercise overlapping jobs, crash and timeout scenarios, long-running tasks, and stale-lock recovery. Run a canary on a low-risk schedule and monitor skipped or blocked jobs before expanding rollout.
- What are alternatives to m-h-1/cron-bundle for Laravel scheduling?
- Laravel's built-in scheduler is the default alternative and is usually sufficient for standard task scheduling. Cron expression libraries such as dragonmantank/cron-expression are common for parsing and evaluation, and Laravel's scheduler already integrates with cron expressions. Choose Cron Bundle if you want centralized cron parsing and evaluation plus the v1.3.0 PHP path and lock-component behavior, and validate maintenance and lock semantics first.