PHPackages                             daycry/cronjob - 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. daycry/cronjob

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

daycry/cronjob
==============

Cronjob library for Codeigniter 4

v2.2.32(2mo ago)6938.8k↓59.2%20[1 PRs](https://github.com/daycry/cronjob/pulls)3MITJavaScriptPHP ^8.2CI passing

Since Jun 3Pushed 2mo ago2 watchersCompare

[ Source](https://github.com/daycry/cronjob)[ Packagist](https://packagist.org/packages/daycry/cronjob)[ Docs](https://github.com/daycry/cronjob)[ RSS](/packages/daycry-cronjob/feed)WikiDiscussions master Synced 2d ago

READMEChangelog (10)Dependencies (17)Versions (56)Used By (3)

[![Donate](https://camo.githubusercontent.com/604e3db9c8751116b3f765aad0353ec7ded655bbe8aaacbc38d8c4a6b784b3ed/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f446f6e6174652d50617950616c2d677265656e2e737667)](https://www.paypal.com/donate?business=SYC5XDT23UZ5G&no_recurring=0&item_name=Thank+you%21&currency_code=EUR)

---

🚀 **[VIEW ONLINE DOCUMENTATION](https://cronjob.readthedocs.io/)** 🚀

---

Note

An improved library has been created that includes everything from this library, plus queues, with an enhanced structure. [jobs vendor](https://github.com/daycry/jobs)

Note

If you want to use a queue system you can use [queues vendor](https://github.com/daycry/queues)

CodeIgniter Job Scheduler
=========================

[](#codeigniter-job-scheduler)

[![Build Status](https://github.com/daycry/cronjob/actions/workflows/php.yml/badge.svg?branch=master)](https://github.com/daycry/cronjob/actions/workflows/php.yml)[![Coverage Status](https://camo.githubusercontent.com/387aa4aace38ad129c87de83d05a746df8d1d1f1256b1c962f824af48da4b992/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6769746875622f6461796372792f63726f6e6a6f622f62616467652e7376673f6272616e63683d6d6173746572)](https://coveralls.io/github/daycry/cronjob?branch=master)[![Downloads](https://camo.githubusercontent.com/a41dff1c1ab73a8d577878da29a444f96238a8939662b7968bc46e8f651a2b59/68747470733a2f2f706f7365722e707567782e6f72672f6461796372792f63726f6e6a6f622f646f776e6c6f616473)](https://packagist.org/packages/daycry/cronjob)[![GitHub release (latest by date)](https://camo.githubusercontent.com/0a08e91abcefa9b3465732e9fd9dd5b3b1bd743aa737278e7a784115fb2f5108/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f762f72656c656173652f6461796372792f63726f6e6a6f62)](https://packagist.org/packages/daycry/cronjob)[![GitHub stars](https://camo.githubusercontent.com/5d992d33f93554bdff698608a83b3cf8d839cdd1eadd89372320548fde4a86cd/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f73746172732f6461796372792f63726f6e6a6f62)](https://packagist.org/packages/daycry/cronjob)[![GitHub license](https://camo.githubusercontent.com/389d7450bbfa7bdddc818b210ac9fc825d70fa6d21af229bd895e673b8eaa876/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f6461796372792f63726f6e6a6f62)](https://github.com/daycry/cronjob/blob/master/LICENSE)

Welcome! The documentation is now organized for easier reading:

- [Installation](docs/installation.md)
- [Dashboard](docs/dashboard.md)
- [Defining Schedules](docs/scheduling.md)
- [Job Dependencies](docs/dependencies.md)
- [Advanced Features](docs/advanced.md)
- [Metrics &amp; Monitoring](docs/metrics-monitoring.md)
- [Roadmap](docs/roadmap.md)

For full usage, examples, and integration details, see each section above.

---

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

[](#quick-start)

This makes scheduling cronjobs in your application simple, flexible, and powerful. Instead of setting up multiple cronjobs on each server your application runs on, you only need to setup a single cronjob to point to the script, and then all of your tasks are scheduled in your code. Besides that, it provides CLI tools to help you manage the tasks that should be ran, a Debug Toolbar collector, and more.

Installation via composer
-------------------------

[](#installation-via-composer)

Use the package with composer install

```
> composer require daycry/cronjob

```

Configuration
-------------

[](#configuration)

Run command:

```
> php spark cronjob:publish

```

This command will copy a config file to your app namespace. Then you can adjust it to your needs. By default file will be present in `app/Config/CronJob.php`.

```
> php spark migrate -all

```

This command create rest server tables in your database.

Starting the Scheduler
----------------------

[](#starting-the-scheduler)

You only need to add a single line to your cronjob:

```
> * * * * * php /path-to-your-project/spark cronjob:run >> /dev/null 2>&1

```

This will call your script every minute. When `cronjob:run` is called, Tasks will determine the correct tasks that should be run and execute them.

Dashboard
---------

[](#dashboard)

You can access the web interface to view the status of jobs using the following url: `https://example.com/cronjob`You must configure an username and password in CronJob.php Config file.

```
    /*
    |--------------------------------------------------------------------------
    | Dashboard login
    |--------------------------------------------------------------------------
    */
    public string $username = 'admin';
    public string $password = 'admin';
```

Custom Views
------------

[](#custom-views)

Go to app\\Config\\CronJob.php -&gt;views\['dashboard'\] and put your view's path there, like: "Cronjob/dashboard" - which is located in app\\Views\\Cronjob\\dashboard.php

```
/*
    |--------------------------------------------------------------------------
    | Views
    |--------------------------------------------------------------------------
    |
    | Notification of each task
    |
    */
    public array $views = [
        'login'                       => '\Daycry\CronJob\Views\login',
        'dashboard'                   => '\Daycry\CronJob\Views\dashboard',
        'layout'                      => '\Daycry\CronJob\Views\layout',
        'logs'                        => '\Daycry\CronJob\Views\logs'
    ];
```

[![CronJob List](/docs/images/cronjob-list.jpg)](/docs/images/cronjob-list.jpg)

Defining Schedules
------------------

[](#defining-schedules)

Tasks are configured with the `app/Config/CronJob.php` config file, inside of the `init()` method. Lets start with a simple example:

```
