2017 © Pedro Peláez
 

package laravel-auditing-filesystem

A filesystem driver for the owen-it/laravel-auditing package. Allows storage of the audits in CSV files, across all registered Laravel disks.

image

betapeak/laravel-auditing-filesystem

A filesystem driver for the owen-it/laravel-auditing package. Allows storage of the audits in CSV files, across all registered Laravel disks.

  • Saturday, July 28, 2018
  • by ymslavov
  • Repository
  • 2 Watchers
  • 2 Stars
  • 84 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 5 Versions
  • 27 % Grown

The README.md

This driver provides the ability to save your model audits in CSV files. It's integrated with Laravel's Storage system so you can use any of the disks specified in your application as the storage destinations of the audit files., (*1)

We also recognize that many systems generate a substantial amount of audit actions and that's why the package allows to specify how the audit files are generated - from a flat catch-all file to files generated for each hour of operation., (*2)

Installation

This driver requires that you are using owen-it/laravel-auditing: ^7.0. Provided this is fulfilled, you can install the driver like so:, (*3)

composer require betapeak/laravel-auditing-filesystem

Setup

You need to add the following config entries in config/audit.php if you need to change the default behaviour of the driver. The drivers key of the config file should look like so:, (*4)

    ...
    'drivers' => [
        'database' => [
            'table'      => 'audits',
            'connection' => null,
        ],
        'filesystem' => [
            'disk'         => 'local',
            'dir'          => 'audit',
            'filename'     => 'audit.csv',
            'logging_type' => 'single',
        ],
    ],
    ...

For simplicity, there are just 4 settings you can adjust and they're described below:, (*5)

Parameter Type Description
disk (string) The name of any filesystem disk in the app. Usage of remote disks (AWS, Rackspace, etc) is discouraged, as it introduces substantial additional http request overheads to the remote disk
dir (string) The directory on the disk where the audit csv files will be saved
filename (string) The filename of the audit file. If logging_type is different from 'single', this filename is ignored as it's being dynamically generated
logging_type (string) Defines how the audit files are being generated. One of 'single', 'daily' or 'hourly'.

Usage

You can use the driver in any Auditable model (locally) like so:, (*6)

<?php
namespace App\Models;

use BetaPeak\Auditing\Drivers\FilesystemDriver;
use Illuminate\Database\Eloquent\Model;
use OwenIt\Auditing\Auditable;
use OwenIt\Auditing\Contracts\Auditable as AuditableContract;

class SomeModel extends Model implements AuditableContract
{
    use Auditable;

    /**
     * Filesystem Audit Driver
     *
     * @var BetaPeak\Auditing\Drivers\Filesystem
     */
    protected $auditDriver = FilesystemDriver::class;

    // ...
}

or globally like so in config/audit.php:, (*7)

return [
    // ...

    'driver' => BetaPeak\Auditing\Drivers\FilesystemDriver::class,

    // ...
];

More information on using community drivers with owen-it/laravel-auditing can be found on their homepage, (*8)

Testing

This package can be tested with phpunit. You need to run composer install (With dev dependencies)., (*9)

By default, you will only be able to run vendor/bin/phpunit --testsuite local., (*10)

If you want to test with remote disks, you need to install Docker and Docker Compose beforehand., (*11)

You need to run docker-compose up -d which will start a local s3 minio instance which will allow testing remote disks., (*12)

You can now run vendor/bin/phpunit or vendor/bin/phpunit --testsuite remote, (*13)

The Versions

28/07 2018

dev-master

9999999-dev

A filesystem driver for the owen-it/laravel-auditing package. Allows storage of the audits in CSV files, across all registered Laravel disks.

  Sources   Download

MIT

The Requires

 

by Yasen Slavov

laravel log csv filesystem lumen logging eloquent export tracking revision audit history record auditing observer changes accountability

28/07 2018

1.1.0

1.1.0.0

A filesystem driver for the owen-it/laravel-auditing package. Allows storage of the audits in CSV files, across all registered Laravel disks.

  Sources   Download

MIT

The Requires

 

by Yasen Slavov

laravel log csv filesystem lumen logging eloquent export tracking revision audit history record auditing observer changes accountability

26/10 2017

1.0.2

1.0.2.0

A filesystem driver for the owen-it/laravel-auditing package. Allows storage of the audits in CSV files, across all registered Laravel disks.

  Sources   Download

MIT

The Requires

 

by Yasen Slavov

laravel log csv filesystem lumen logging eloquent export tracking revision audit history record auditing observer changes accountability

26/10 2017

1.0.1

1.0.1.0

A filesystem driver for the owen-it/laravel-auditing package. Allows storage of the audits in CSV files, across all registered Laravel disks.

  Sources   Download

MIT

The Requires

 

by Yasen Slavov

laravel log csv filesystem lumen logging eloquent export tracking revision audit history record auditing observer changes accountability

26/10 2017

1.0

1.0.0.0

A filesystem driver for the owen-it/laravel-auditing package. Allows storage of the audits in CSV files, across all registered Laravel disks.

  Sources   Download

MIT

The Requires

 

by Yasen Slavov

laravel log csv filesystem lumen logging eloquent export tracking revision audit history record auditing observer changes accountability