PHPackages                             bmitch/consoleevents - 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. [CLI &amp; Console](/categories/cli)
4. /
5. bmitch/consoleevents

ActiveLibrary[CLI &amp; Console](/categories/cli)

bmitch/consoleevents
====================

Events for Laravel Console Commands

1.0.0(9y ago)17953[1 issues](https://github.com/bmitch/consoleEvents/issues)MITPHPPHP &gt;=5.6.4

Since Nov 23Pushed 9y agoCompare

[ Source](https://github.com/bmitch/consoleEvents)[ Packagist](https://packagist.org/packages/bmitch/consoleevents)[ RSS](/packages/bmitch-consoleevents/feed)WikiDiscussions master Synced 2mo ago

READMEChangelog (4)Dependencies (2)Versions (5)Used By (0)

Console Events for Laravel Commands
===================================

[](#console-events-for-laravel-commands)

[![Build Status](https://camo.githubusercontent.com/4f2ebf4c695341864469f3fdf0bd509b3e0af8bfda38ab8d429d009c69e89e8c/68747470733a2f2f7472617669732d63692e6f72672f626d697463682f636f6e736f6c654576656e74732e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/bmitch/consoleEvents)

What is it?
-----------

[](#what-is-it)

This package allows you to have events triggered by your Artisan Commands. The events available are:

`Bmitch\ConsoleEvents\Events\CommandStarting`Triggered when an Artisan Command is starting.

`Bmitch\ConsoleEvents\Events\CommandTerminating`Triggered when an Artisan Command is terminating.

Why use it?
-----------

[](#why-use-it)

The main reason I created this package was for a use case where multiple commands were executed nightly and I wanted an easy way to log when they started and stopped. By hooking into these events it makes it easy.

How to Install
--------------

[](#how-to-install)

### Add to composer

[](#add-to-composer)

```
composer require bmitch/consoleevents

```

### Modify commands to extend custom class

[](#modify-commands-to-extend-custom-class)

In any command that you wish to trigger these events simply replace the:

```
use Illuminate\Console\Command;

```

with

```
use Bmitch\ConsoleEvents\Command;

```

### Create and Register Listeners

[](#create-and-register-listeners)

Create two listeners within the `app/Listeners` folder like this:

```
