Download the PHP package zuqongtech/laravel-kronos without Composer

On this page you can find all versions of the php package zuqongtech/laravel-kronos. 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 laravel-kronos

⏱ Laravel Kronos

Latest Version on Packagist Total Downloads Tests PHPStan PHP Version Laravel Version

A reactive workflow orchestration and scheduling engine for Laravel.

Rule-driven. DAG-based. Multi-node safe.

Kronos bridges the gap between Laravel's built-in cron scheduler and a full workflow orchestration platform. It watches your Eloquent models, evaluates configurable rules, and reactively writes a canonical kronos.yaml / Redis configuration — then executes complex multi-step DAG workflows with branching, parallel execution, retries, shared context, and a full audit trail.

Think of it as Laravel's scheduler meets Apache Airflow, natively integrated with Eloquent, Horizon, and Filament.


Table of Contents


Why Kronos?

Laravel's built-in scheduler is great for simple cron tasks but falls short when you need:

Need Laravel Scheduler Kronos
Database-driven schedules ❌ Hardcoded in code ✅ DB + YAML + Redis
Multi-step workflow DAGs
Reactive DB-change triggers ✅ Rule Engine
Step dependency resolution ✅ Kahn's Algorithm
Parallel step execution
Conditional branching
Shared inter-step context
Per-run audit trail
Multi-node safe execution Partial (onOneServer) ✅ Full distributed locking
Admin UI ✅ Filament v3 plugin
Version-controlled config kronos.yaml

Requirements

Dependency Version
PHP ^8.2
Laravel ^11.0 or ^12.0
Redis Any (for locking + multi-node)
Filament (optional) ^3.0

Installation

Install via Composer:

Run the install command to publish config and run migrations:

This publishes config/kronos.php, runs the five Kronos migrations, and creates an empty storage/kronos.yaml.

Manual publish (optional):


Quick Start

1. Register rules and workflows in a Service Provider

Create a dedicated provider or use your AppServiceProvider:

2. Implement your step jobs

3. Trigger a workflow manually

Or via the facade:


Core Concepts

Rule Engine

The rule engine is the reactive heart of Kronos. Rules watch Eloquent model events and, when a condition is met, dispatch a debounced rebuild of the canonical config.

Cross-model conditions — a rule can require two models to both satisfy conditions:

How debouncing works: When any rule matches, Kronos dispatches RebuildKronosConfig — a ShouldBeUnique job. If fifty model saves fire in rapid succession, only one rebuild executes. This prevents write storms.


Config Writer (YAML + Redis)

Every rule match and workflow registration ultimately writes to two places:

storage/kronos.yaml — human-readable, version-controllable source of truth:

Redis (kronos:config) — fast key-value store read at every kernel boot. Preferred over the YAML file on multi-node setups. When the YAML is written, Redis is updated atomically and a pub/sub invalidation is broadcast to all nodes.

The YAML file is written using a rename-after-write strategy (write to .tmp, then rename()), guaranteeing no partial reads during kernel boot.


Workflow Orchestration

A workflow is a named DAG (Directed Acyclic Graph) of steps with a trigger, optional branching, and shared context.

Each ->register() call persists the workflow to the kronos_workflows table and triggers a config rebuild.


DAG Resolution

Kronos resolves step execution order using Kahn's topological sort algorithm. Steps with no unmet dependencies are dispatched as a batch (running in parallel via the queue). When a batch completes, the resolver re-evaluates and dispatches the next ready batch.

If a circular dependency is detected, Kronos throws KronosDeadlockException at registration time — not at runtime.


Workflow Context

WorkflowContext is a persistent key-value store shared across all steps in a run. It is backed by the kronos_workflow_runs.context JSON column and survives queue worker restarts and container crashes.

Available methods:


Triggers

Every workflow has exactly one trigger. Available trigger types:

Type Description Example
cron Time-based cron schedule ->trigger()->cron('0 9 * * 1-5')
manual API / Artisan only ->trigger()->manual()
model_event Eloquent model event ->trigger()->onModelEvent(Invoice::class, 'created')
laravel_event Application event ->trigger()->onEvent(PayrollClosed::class)
webhook Inbound HTTP POST ->trigger()->webhook('/kronos/trigger/payroll')
after_workflow On completion of another workflow ->trigger()->afterWorkflow('data_ingestion')

Cron with timezone:


Branching

Workflows can define conditional branches evaluated at runtime against the workflow context:

The branch arm that does not match has all its steps marked as skipped — visible in the run history.


Building Steps

Every step must implement ZuqongTech\Kronos\Contracts\KronosStep:

Step options on the definition:


Scheduled Tasks (Simple Cron)

For simple scheduled commands without multi-step workflows, use the KronosScheduledTask model directly or via the Filament UI:

Or use the rule engine to derive tasks from your own models:


Multi-Node Deployments

Enable multi-node mode

When KRONOS_MULTI_NODE=true:

Recommended ECS / Kubernetes setup

Run a single dedicated scheduler replica that only runs schedule:run, separate from your web/worker replicas:

This eliminates multi-node scheduler overlap at the infrastructure level, leaving Redis locking as a defence-in-depth layer only.

Write-path flow on multi-node


Filament UI

Kronos ships a first-class Filament v3 plugin.

Register the plugin

Available UI screens

Screen Description
Kronos Dashboard Live stats — running workflows, today's failures, completion counts
Workflows Create, edit, enable/disable, and manually trigger workflows
Scheduled Tasks CRUD for simple cron tasks; changes rebuild kronos.yaml automatically
Run History Per-run status, step timeline, context inspector, exception viewer

Note: The Filament plugin requires filament/filament: ^3.0 in your application's composer.json. It is suggested but not required by Kronos itself.


Webhook API

Enable the HTTP webhook endpoint for external workflow triggers:

Trigger a workflow

Response:

Check run status

Response:


Artisan Commands

Command Description
kronos:install Publish config, run migrations
kronos:list List all workflows and scheduled tasks
kronos:trigger {workflow} Manually trigger a workflow by name
kronos:trigger {workflow} --context='{"key":"val"}' Trigger with JSON context
kronos:status Show recent workflow run history
kronos:status {run_id} Show step-level detail for a specific run
kronos:rebuild Force a full config rebuild from DB → YAML + Redis

Events

Kronos fires standard Laravel events you can listen to:

Register listeners in your EventServiceProvider:

Payload:


Configuration Reference

Environment variables summary:

Variable Default Description
KRONOS_MULTI_NODE false Enable distributed multi-node mode
KRONOS_REDIS_CONNECTION default Redis connection for locking + config
KRONOS_QUEUE_CONNECTION redis Queue connection for Kronos jobs
KRONOS_QUEUE_NAME kronos Queue name for Kronos jobs
KRONOS_WEBHOOK_ENABLED false Enable HTTP webhook endpoint
KRONOS_WEBHOOK_SECRET Shared secret for webhook auth
KRONOS_WEBHOOK_PREFIX kronos URL prefix for webhook routes
KRONOS_RETENTION_DAYS 30 Days to keep run history
KRONOS_TIMEZONE UTC Default schedule timezone

Testing

Kronos is tested with PestPHP.

Testing workflows in your application

Kronos exposes Laravel's standard Bus::fake() and Event::fake() patterns cleanly:

Testing your step jobs directly

Step jobs are plain PHP classes — test them in isolation without queue infrastructure:


FAQ

Q: Does Kronos replace Laravel Horizon?

No — Kronos uses Horizon (or any queue driver) to dispatch step jobs. Kronos handles orchestration (which jobs run in what order and when). Horizon handles execution (the worker pool, monitoring, retries at the queue level).

Q: Can I use a database queue instead of Redis?

Yes, Kronos works with any Laravel queue driver. Redis is recommended for multi-node deployments because it is also used for distributed locking and config pub/sub. For single-node or development setups, QUEUE_CONNECTION=database works fine.

Q: Does Kronos work with Laravel Octane?

Yes. The service provider uses callAfterResolving for schedule hydration, which is compatible with Octane's persistent process model. Ensure KRONOS_MULTI_NODE=true is set so config state is read from Redis rather than a process-local file cache.

Q: Can I define workflows in a config file instead of code?

Not currently — workflows are defined in code (service providers) and persisted to the DB. A YAML-first workflow definition format is planned for a future release.

Q: How does Kronos prevent duplicate job execution on multi-node?

Three layers:

  1. RebuildKronosConfig is ShouldBeUnique — only one rebuild runs at a time.
  2. ExecuteWorkflowStep is ShouldBeUnique per (run_id, step_name) — a step can only be dispatched once.
  3. KronosOrchestrator::advance() acquires a Redis lock per run before evaluating ready steps.

Q: Can I cancel a running workflow?

Manual cancellation via Artisan or the Filament UI is on the roadmap. Currently you can set status = cancelled directly on the KronosWorkflowRun record — the orchestrator checks isTerminal() before advancing.

Q: How are failed workflows retried?

At the workflow level, retries are not automatic — re-triggering creates a new run. Step-level retries (the ->retries(n) option) are automatic and use Laravel's built-in job retry mechanism.


Changelog

Please see CHANGELOG.md for a history of changes.


Contributing

Contributions are very welcome. Please review CONTRIBUTING.md for guidelines on:


Security

If you discover a security vulnerability, please review SECURITY.md and do not open a public issue. Email [email protected] directly.


Credits


License

The MIT License (MIT). Please see LICENSE for details.# laravel-kronos


All versions of laravel-kronos with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
clue/redis-react Version ^2.7
illuminate/bus Version ^12.60|^13.10
illuminate/queue Version ^12.60|^13.10
illuminate/redis Version ^12.60|^13.10
illuminate/support Version ^12.60|^13.10
laravel/framework Version ^12.60|^13.10
react/async Version ^4.3
react/event-loop Version ^1.5
react/http Version ^1.11
react/promise Version ^3.2
react/socket Version ^1.17
react/stream Version ^1.4
symfony/yaml Version ^7.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 zuqongtech/laravel-kronos contains the following files

Loading the files please wait ...