PHPackages                             ninjasimon/laravel-persistable-events - 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. ninjasimon/laravel-persistable-events

ActiveProject

ninjasimon/laravel-persistable-events
=====================================

Simple persistence of Laravel events

07PHP

Since Mar 10Pushed 9y ago2 watchersCompare

[ Source](https://github.com/ninjasimon/laravel-persistable-events)[ Packagist](https://packagist.org/packages/ninjasimon/laravel-persistable-events)[ RSS](/packages/ninjasimon-laravel-persistable-events/feed)WikiDiscussions master Synced today

READMEChangelogDependenciesVersions (1)Used By (0)

Persistable Laravel Events
==========================

[](#persistable-laravel-events)

This package provides a quick and easy way to store Laravel Framework events to use for later debugging, monitoring, or analysis.

Quickstart: 4-Step Installation
-------------------------------

[](#quickstart-4-step-installation)

It's easy to get started storing events. With no configuration, the package will store the class name, serialized event object, and timestamp for any desired events.

### Step 1: Install Composer Package

[](#step-1-install-composer-package)

Install the composer package by running the following:

```
composer require ninjasimon/laravel-persistable-events

```

### Step 2: Add the service provider to config/app.php

[](#step-2-add-the-service-provider-to-configappphp)

As with most Laravel packages, you'll need to add the service provider to your app.php configuration file. Simply add the following line to the 'providers' array:

```
// config/app.php

'providers' => [
        // ...

        PersistableEvents\PersistableEventServiceProvider::class,

 ],
```

### Step 3: Create event database table

[](#step-3-create-event-database-table)

Run migrations to create a database table to store events. Out of the box, the package will use the database connection you have distinguished as the 'default' connection in your config/database.php file. This can be changed through the package configuration.

```
php artisan migrate

```

### Step 4: Extend the PersistableEvent class

[](#step-4-extend-the-persistableevent-class)

To add persistence to any event, simply extend the PersistableEvents\\PersistableEvent abstract class as shown below. By default, when an event fires which extends this class, the event's class name, timestamp, and serialized object will be written to the database. These values can be changed, and/or additional values can be added by overriding getter methods.

```
