Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Cron Expression Laravel Package

carlossosa88/cron-expression

Fork of dragonmantank/cron-expression adding nonstandard seconds support for Fcron-style scheduling. Parse cron strings and macros, check if a schedule is due, and compute next/previous run dates with optional second-level precision control.

View on GitHub
Deep Wiki
Context7

Product Decisions This Supports

  • Job Scheduling & Task Automation: Enables precise, cron-based scheduling for background jobs, batch processing, or recurring tasks in PHP/Laravel applications (e.g., report generation, cleanup jobs, or API rate-limiting).
  • Laravel Task Scheduling: Complements Laravel’s built-in scheduler (Artisan::schedule()) by providing granular control over cron expressions (e.g., second-level precision for high-frequency tasks).
  • Build vs. Buy: Avoids reinventing cron parsing logic, reducing dev time and technical debt. Leverages a battle-tested fork with second-level support (critical for frameworks like Fcron).
  • Roadmap Priorities:
    • Feature: Add cron-based scheduling to a SaaS platform’s admin dashboard for tenant-specific job configurations.
    • Tech Debt: Replace ad-hoc cron parsing in legacy systems with this standardized library.
    • Scalability: Enable micro-batching for real-time systems (e.g., "trigger every 5 seconds" for IoT data processing).
  • Use Cases:
    • Event-Driven Systems: Schedule webhooks or notifications (e.g., "send reminder every 30 minutes after event X").
    • Maintenance Tasks: Database optimizations, cache invalidation, or log rotation with custom intervals.
    • Multi-Tenancy: Dynamic cron expressions per user/tenant (e.g., "run at 3 AM UTC for tenant A, 9 AM for tenant B").

When to Consider This Package

  • Adopt When:
    • Your PHP/Laravel app requires precise cron scheduling (including seconds) beyond Laravel’s default @every syntax.
    • You need to parse or validate cron expressions programmatically (e.g., user-uploaded schedules or API inputs).
    • Your team lacks expertise in writing robust cron parsers from scratch.
    • You’re using Fcron or need second-level granularity (e.g., for high-frequency polling).
    • You want to standardize cron logic across microservices or legacy systems.
  • Look Elsewhere If:
    • You’re using Node.js/Python/Ruby: Native cron libraries in those ecosystems may be more mature (e.g., node-cron, APScheduler).
    • Your use case is serverless: AWS CloudWatch Events or Azure Functions timers may suffice without a PHP cron parser.
    • You need GUI tools: Consider dedicated cron editors (e.g., Crontab.guru) for non-developer users.
    • Your app is monolithic and cron-free: If no scheduling is required, this adds unnecessary complexity.

How to Pitch It (Stakeholders)

For Executives: "This lightweight PHP package lets us schedule tasks with the precision of Unix cron—down to the second—without building or maintaining custom parsing logic. It’s already used by Laravel, so it’s production-ready. For example, we could automate high-frequency data syncs for our IoT customers or let tenants configure their own job schedules in the dashboard. It’s a low-risk, high-reward way to add reliability and flexibility to our backend."

For Engineering: *"This is a drop-in replacement for ad-hoc cron parsing in our codebase. Key benefits:

  • Supports seconds: Critical for Fcron or high-frequency tasks (e.g., */5 for every 5 seconds).
  • Validates expressions: Catches malformed cron strings early (e.g., 60 in minutes).
  • Laravel-compatible: Works seamlessly with Artisan::schedule() or standalone.
  • Lightweight: ~1MB, no external dependencies beyond PHP 7.1+. Use case: Replace our hacky strtotime-based scheduler with this for predictable, maintainable cron logic. The changelog shows active maintenance, and it’s MIT-licensed."*

For Developers: *"Need to schedule a job every 3 seconds? Or parse a cron string from a user input? This library handles it all. Example:

$cron = CronExpression::factory('*/5 * * * * *'); // Every 5 seconds
if ($cron->isDue()) {
    // Run task
}

It’s also used in Laravel’s scheduler, so it’s battle-tested. Just composer require and go."*

Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
craftcms/url-validator
directorytree/privacy-filter-classifier
directorytree/privacy-filter
datacore/hub-sdk
develia/commons
cuci/prototurk-sdk
cuci/prototurk-sdk-symfony
develia/geo-bundle
dreamzy/livewire-charts
touchestate-sdk/php-sdk
22h/doctrine-garbage-collection-bundle
agtp/agtp-php
agtp/mod-php
splash/sonata-admin
splash/metadata
splash/openapi
splash/scopes
splash/toolkit
testo/output-teamcity
testo/bridge-symfony