PHPackages                             wolfcode/php-cron - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. wolfcode/php-cron

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

wolfcode/php-cron
=================

PHP 8.2+ Cron scheduler with fluent API

v0.1.1(1mo ago)01372MITPHPPHP &gt;=8.2

Since Jun 21Pushed 1mo agoCompare

[ Source](https://github.com/wolf-leo/php-cron)[ Packagist](https://packagist.org/packages/wolfcode/php-cron)[ RSS](/packages/wolfcode-php-cron/feed)WikiDiscussions main Synced 2w ago

READMEChangelog (5)DependenciesVersions (3)Used By (2)

php-cron
========

[](#php-cron)

[中文文档](README.zh.md)

PHP 8.2+ task scheduler with a fluent API and full lifecycle management.

Features
--------

[](#features)

- **Cron expressions** — standard 5-field or 6-field (with seconds); supports `*/n`, ranges, lists, weekday/month names, `@daily` aliases
- **Fluent API** — `second(3)`, `minute(5)`, `hour(2)`, `dailyAt('8:30')`, `weeklyOn('monday')`
- **Constraints** — time range `between()`, environment `environments()`, condition `when()`/`skip()`
- **Lifecycle hooks** — `before()`, `after()`, `onSuccess()`, `onFailure()`
- **Overlap prevention** — `withoutOverlapping()` via file-based mutex
- **Timezone support** — global per-daemon and per-task
- **Three task types** — Closure, shell command, `Class@method`
- **Daemon mode** — continuous loop with second precision, auto-fork to background

Requirements
------------

[](#requirements)

ExtensionPurposeRequired`ext-pcntl`Process control: `pcntl_fork()` (background daemon), signal handlingOptional — needed for daemon background mode`ext-posix`POSIX: `posix_setsid()` (new session), `posix_kill()` (stop daemon)Optional — needed for daemon start/stop`ext-json`Task info serialization (`.tasks.json` PID file)Optional — bundled with PHP by default`ext-opcache``opcache_reset()` (periodic reset in long-running process)Optional — works fine without> `ext-pcntl` and `ext-posix` are CLI-only and unavailable in Web SAPI. If `ext-posix` is missing, `stop` falls back to `exec("kill ...")`.

Installation
------------

[](#installation)

```
composer require wolfcode/php-cron
```

Quick Start
-----------

[](#quick-start)

```
