PHPackages                             casperengl/cron-ms - 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. casperengl/cron-ms

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

casperengl/cron-ms
==================

Runs cron jobs based on milliseconds, instead of minutes, hours, days, weeks and years

0165[1 PRs](https://github.com/CasperEngl/cron-ms/pulls)PHP

Since Jun 3Pushed 2y ago2 watchersCompare

[ Source](https://github.com/CasperEngl/cron-ms)[ Packagist](https://packagist.org/packages/casperengl/cron-ms)[ RSS](/packages/casperengl-cron-ms/feed)WikiDiscussions master Synced yesterday

READMEChangelogDependenciesVersions (3)Used By (0)

Cron Milliseconds
=================

[](#cron-milliseconds)

[![https://scrutinizer-ci.com/g/CasperEngl/cron-ms?b=master](https://camo.githubusercontent.com/07e60d651a9604313b122d15f777fd22999008037753602e3f945b06873619c4/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f436173706572456e676c2f63726f6e2d6d732f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://camo.githubusercontent.com/07e60d651a9604313b122d15f777fd22999008037753602e3f945b06873619c4/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f436173706572456e676c2f63726f6e2d6d732f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)[![https://scrutinizer-ci.com/g/CasperEngl/cron-ms?b=master](https://camo.githubusercontent.com/6c825dc0b389eeae671790689861819e27f2e6d22c104bc6286acc90c4a1b23c/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f436173706572456e676c2f63726f6e2d6d732f6261646765732f6275696c642e706e673f623d6d6173746572)](https://camo.githubusercontent.com/6c825dc0b389eeae671790689861819e27f2e6d22c104bc6286acc90c4a1b23c/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f436173706572456e676c2f63726f6e2d6d732f6261646765732f6275696c642e706e673f623d6d6173746572)

This library makes it easy to run a piece of code, every X milliseconds or seconds.

```
// Initialization and running

// From milliseconds
$cron = CronMs::fromMs(5000, function ($i /* each iteration count is returned here, start at 0 */) {
    // ... your code
});

// From seconds
$cron = CronMs::fromSeconds(5, function ($i /* each iteration count is returned here, start at 0 */) {
    // ... your code
});

// Initialization only

// You can also start the process yourself later.
// Just pass false as the third (3rd) parameter
$cron = CronMs::fromMs(5000, function ($i /* each iteration count is returned here, start at 0 */) {
  // ... your code
}, false /* disables automatic run */);

// Some other code

// Some time later
$cron->run();

// Properties

// You can access `$ms`, `$start_timestamp` and `$startTime` from the CronMs instance
$cron = CronMs::fromMs(5000, function ($i /* each iteration count is returned here, start at 0 */) {
  // ... your code
});

$cron->ms // 5000
$cron->start_timestamp // unix timestamp
$cron->start // Carbon\Carbon instance
```

Testing
=======

[](#testing)

Run the `./vendor/bin/phpunit` (optionally with the `--testdox` parameter, for pretty output). Be aware, tests are longrunning. This is because each test runs the `u_sleep()` method internally.

###  Health Score

20

—

LowBetter than 14% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity10

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity36

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://www.gravatar.com/avatar/9cec3fc471ee44a78a6928337d24a3e9766cfab281f93695ab8fd53d4ef9f02a?d=identicon)[CasperEngl](/maintainers/CasperEngl)

---

Top Contributors

[![CasperEngl](https://avatars.githubusercontent.com/u/11478629?v=4)](https://github.com/CasperEngl "CasperEngl (31 commits)")

### Embed Badge

![Health badge](/badges/casperengl-cron-ms/health.svg)

```
[![Health](https://phpackages.com/badges/casperengl-cron-ms/health.svg)](https://phpackages.com/packages/casperengl-cron-ms)
```

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
