PHPackages                             cossou/eventcron - 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. cossou/eventcron

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

cossou/eventcron
================

0.3.2(12y ago)264121PHPPHP &gt;=5.3.0

Since Feb 9Pushed 12y ago1 watchersCompare

[ Source](https://github.com/Quagh/laravel-4-eventcron)[ Packagist](https://packagist.org/packages/cossou/eventcron)[ RSS](/packages/cossou-eventcron/feed)WikiDiscussions master Synced 3d ago

READMEChangelogDependencies (2)Versions (5)Used By (0)

Laravel 4 EventCRON
===================

[](#laravel-4-eventcron)

A Laravel 4 package that enables you to queue events and fire them in sequence, or at a specific time in the future.

Use Cases
---------

[](#use-cases)

- Sending a user an e-mail 24 hours after registration
- Scheduled mailing and newsletters
- Time consuming processes that would run better at night
- Firing events in a continuous matter (just queue a new event once it's fired)

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

[](#installation)

Add the package to your composer.json and run `composer update`.

```
{
	"require": {
		"cossou/eventcron": "*"
	}
}

```

Add the service provider in `app/config/app.php`:

```
'providers' => [
	…

	'Cossou\EventCRON\EventCRONServiceProvider'
]
```

**Optionally** add the facade to your aliases:

```
'aliases' => [
	…

	'EventCRON' => 'Cossou\EventCRON\Facades\EventCRON'
]
```

If you are using Laravel 4.0 ,perform the migration to create the database tables:

```
php artisan migrate --package=cossou/eventcron

```

Or if you are using Laravel 4.1, publish the package migration to your application

```
php artisan migrate:publish cossou/eventcron
php artisan migrate

```

How to Use
----------

[](#how-to-use)

To get started, there are three ways in which you can utilize this package.

Via the facade, if you added it to your configuration file (preferred way):

```
EventCRON::queue('myevent');
```

By using the Laravel IoC container:

```
App::make('eventcron')->queue('myevent');
```

Directly through the class:

```
$eventcron = new Cossou\EventCRON\EventCRONManager();
$eventcron->queue('myevent');
```

### Adding Events

[](#adding-events)

#### First Steps

[](#first-steps)

As shown, you can just queue your event and listen to it elsewhere.

```
EventCRON::queue('myevent');
```

```
Event::listen('myevent', function()
{
	echo 'myevent just got fired!';
});
```

Flushing the queue for this event will fire all of them at once, since no time has been set.

#### Using arguments

[](#using-arguments)

You can also pass some data to your event handler in the form of an array.

```
EventCRON::queue('myevent', ['string', $variable, 12, new Object()]);
```

Laravel will then extract all of these variables and pass them to your event handler:

```
Event::listen('myevent', function($string, $variable, $number, $object)
{
	echo 'myevent just got fired with some neat arguments';
	dd($string, variable, $number, $object);
});
```

#### Timing Is Everything

[](#timing-is-everything)

Of course, the main idea of this package is to schedule your events. Just pass a Carbon instance as third parameter:

```
EventCRON::queue('myevent', NULL, Carbon\Carbon::now()->addHour());
```

This event will only be triggered one hour from now.

*Carbon is a nice extension to PHP's datetime class(es). For more info: .*

### Flushing the Queue

[](#flushing-the-queue)

Now that you've added all these events, you'd want them to be triggered so your whole setup actually does something.

To trigger the queue for a single event:

```
EventCRON::flush('myevent');
```

To trigger the queue of all events:

```
EventCRON::flushAll();
```

**Please note:** events with an execution time set will only be triggered if that moment is in the past. In addition, if the configuration file states `enabled` as `false` or `run_only_from_cli` as `true` (and you're flushing a queue from code), nothing will happen.

### The CLI + Creating a CRON Job

[](#the-cli--creating-a-cron-job)

The following commands are used to flush queues from the CLI:

```
php artisan eventcron:trigger myevent

```

```
php artisan eventcron:trigger:all

```

On most occasions though, you'd trigger events in your queue with a CRON job instead of directly from code or the CLI.

Use `crontab -e` or `sudo crontab -e` to get into your CRON file and add the following line at the end to flush all queues every minute (because you never know when you've scheduled an event):

```
*/1 * * * * php /var/www/myproject/artisan eventcron:trigger:all

```

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

[](#configuration)

Publish the package's configuration file with:

```
php artisan config:publish cossou/eventcron

```

### enabled (default `true`)

[](#enabled-default-true)

Simply enable or disable the package.

```
BOOLEAN true / false

```

### run\_only\_from\_cli (default `true`)

[](#run_only_from_cli-default-true)

Allow the flushing of queues only from your command line interface (CLI).

```
BOOLEAN true / false

```

### max\_events\_per\_execution (default `50`)

[](#max_events_per_execution-default-50)

Maximum number of events to fire in one run (set it to a lower number if you don't want the server go slower).

```
INTEGER number

```

### log\_events (default `false`)

[](#log_events-default-false)

Whether or not to write debug messages your log.

```
BOOLEAN true / false

```

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity22

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity51

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 60% 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.

###  Release Activity

Cadence

Every ~25 days

Total

4

Last Release

4399d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/711940?v=4)[Sebastiaan Luca](/maintainers/sebastiaanluca)[@sebastiaanluca](https://github.com/sebastiaanluca)

---

Top Contributors

[![louim](https://avatars.githubusercontent.com/u/923718?v=4)](https://github.com/louim "louim (3 commits)")[![sebastiaanluca](https://avatars.githubusercontent.com/u/711940?v=4)](https://github.com/sebastiaanluca "sebastiaanluca (2 commits)")

### Embed Badge

![Health badge](/badges/cossou-eventcron/health.svg)

```
[![Health](https://phpackages.com/badges/cossou-eventcron/health.svg)](https://phpackages.com/packages/cossou-eventcron)
```

###  Alternatives

[flarum/core

Delightfully simple forum software.

211.3M1.9k](/packages/flarum-core)[erlandmuchasaj/laravel-gzip

Gzip your responses.

40129.3k2](/packages/erlandmuchasaj-laravel-gzip)[interaction-design-foundation/laravel-geoip

Support for multiple Geographical Location services.

17221.0k3](/packages/interaction-design-foundation-laravel-geoip)[aedart/athenaeum

Athenaeum is a mono repository; a collection of various PHP packages

245.2k](/packages/aedart-athenaeum)

PHPackages © 2026

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