Download the PHP package directorytree/cadence without Composer

On this page you can find all versions of the php package directorytree/cadence. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package cadence

Cadence

Model-based scheduling for Laravel.

Tests Total Downloads Latest Version License

Contents · Installation · Usage


Cadence provides a driver-based scheduling system for your Eloquent models using cron expressions or RRULE recurrence patterns. Attach one or many schedules to any model, and Cadence will track and dispatch events when they're due.

Contents

Requirements

Installation

You can install the package via composer:

Then, install at least one schedule driver:

Publish and run the migrations:

This creates a schedules table with the following columns:

If you're upgrading from an existing Cadence installation, publish and run the new migration before using the schedule enable / disable APIs:

Setup

Implement the Schedulable interface and use the HasSchedules trait on any model you want to schedule:

Usage

Adding Schedules

Create a driver instance and add it to your model:

With RRULE expressions:

Timezones

Schedules can be timezone-aware. Pass the timezone as the second argument:

Or set it via the setTimezone() method:

The schedule's timezone only determines when occurrences happen. Cadence converts computed run dates to your application's timezone before storing them, so the due() scope and schedules:run command fire at the correct moment.

Saving a timezone change on a schedule recalculates next_run_at from the current time. It preserves last_run_at, and disabled schedules keep next_run_at set to null.

For RRULE schedules with a local DTSTART, the start keeps the same local date and time in the new timezone. Changing the timezone does not reset the start or the rule's COUNT or INTERVAL.

Disabling Schedules

Schedules may be disabled without deleting them:

Disabling a schedule sets disabled_at and clears next_run_at, so the schedule will not be picked up by the schedules:run command.

Enable the schedule again to compute its next occurrence from the current time:

You may also check or query schedule state:

Running Due Schedules

Register the schedules:run command in your application's scheduler to run every minute:

This command queries all schedules where next_run_at <= now(), dispatches a ScheduleTriggered event for each, and advances next_run_at to the next occurrence.

If dispatching or advancing a schedule throws an exception, the command reports it through Laravel's exception handler and continues processing the remaining schedules. Like Laravel's scheduler, it returns a successful exit code when processing finishes, even if individual schedules failed. A schedule whose event fails to dispatch is not advanced, so it can be attempted again on the next run.

Listeners may receive the same occurrence again if part of the dispatch succeeds before a failure, or if advancing the schedule fails after dispatch.

To handle duplicate deliveries, combine $event->schedule->getKey() and $event->scheduledAt->getTimestamp() into a stable key for the occurrence, scoped to each listener. For database work, enforce uniqueness on that key and record it in the same transaction as the work. For external services that support idempotency keys, pass the same key on each attempt so repeated requests do not repeat the side effect.

Listening for Triggered Schedules

Listen for the ScheduleTriggered event to perform work when a schedule fires:

Register it in your EventServiceProvider or use event discovery.

Handling Late Runs

Each ScheduleTriggered event includes two immutable timestamps:

These timestamps remain unchanged when the schedule advances, including when a queued listener reloads the schedule from the database. Use them to decide whether a late occurrence is still useful. For example, a queued listener can decline work dispatched more than five minutes late:

Cadence still updates last_run_at and advances next_run_at when a listener declines the work. These fields track Cadence triggering the occurrence, not whether a listener completes its work. The timestamps describe dispatch timing; any delay waiting in a queue is separate.

Drivers

Cadence uses a driver-based architecture. Drivers are automatically registered when their backing library is installed.

Cron

Requires dragonmantank/cron-expression:

This package is already required by the Laravel framework core.

RRULE (php-rrule)

Requires rlanvin/php-rrule:

RRULE (Recurr)

Requires simshaun/recurr:

Both RRULE drivers add a DTSTART when the expression is first evaluated or serialized. The start uses the schedule's timezone, or the application's default timezone when none is provided. addSchedule() stores the start and timezone so COUNT and INTERVAL stay anchored when the schedule is reloaded.

To choose a specific start, include DTSTART in the expression. Explicit starts are preserved. Existing stored expressions without DTSTART should be updated with the intended start; their original implicit start was not recorded.

Custom Drivers

Create a class that extends the base Schedule driver:

Then register it in your AppServiceProvider:

Customizing Drivers

Each driver exposes a static tap method to configure the underlying library instance before it's used:

Callbacks are scoped to the concrete driver class. Configuring or clearing one driver's callback does not affect other drivers or subclasses.

Pass null to clear the callback:


All versions of cadence with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
illuminate/contracts Version ^11.0|^12.0|^13.0
illuminate/database Version ^11.0|^12.0|^13.0
illuminate/support Version ^11.0|^12.0|^13.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package directorytree/cadence contains the following files

Loading the files please wait ...