DEV Community

Cover image for Cronark: Lightweight Cron-Based Job Scheduling for PHP
Hadi Akbarzadeh
Hadi Akbarzadeh

Posted on

Cronark: Lightweight Cron-Based Job Scheduling for PHP

If you need background jobs in PHP but don’t want to deal with Redis, RabbitMQ, or heavy infrastructure, Cronark might be exactly what you’re looking for.

It’s a minimal, cron-driven job scheduler that works with plain PHP (8.1+) and your system’s cron; no external services required.

🤔 Why Use It?

Most job queues require extra setup and maintenance. That’s fine for large systems, but for small to mid-size projects? Overkill.

Cronark keeps it simple:

  • No external dependencies
  • No queue servers
  • No background daemons
  • Just PHP + cron

If your server can run cron, you’re good to go.

⚙️ Basic Usage

Install via Composer:

composer require nabeghe/cronark
Enter fullscreen mode Exit fullscreen mode

Create a job:

class SendEmailsJob
{
    public function __invoke()
    {
        echo "Sending emails...\n";
    }
}
Enter fullscreen mode Exit fullscreen mode

Register and run it in a worker:

$cronark = new \Nabeghe\Cronark\Cronark();
$cronark->addJob(SendEmailsJob::class, "email");
$cronark->start("email");
Enter fullscreen mode Exit fullscreen mode

Add to crontab:

* * * * * php /path/to/worker.php
Enter fullscreen mode Exit fullscreen mode

Done. Your job runs every minute.

🎯 When It Makes Sense

  • Cronark is perfect if you:
  • Are on shared hosting
  • Want lightweight scheduling
  • Prefer minimal infrastructure
  • Need recurring background tasks

It’s not trying to replace enterprise queue systems; it’s built for simplicity and practicality.

If you like clean solutions with zero drama, this one’s worth checking out.


Github & Docs

Top comments (0)