siduko / laravel-activitylog by siduko

This laravel 5 package provides to log the activity of the users
7
0
2
Package Data
Maintainer Username: siduko
Maintainer Contact: laivu.fly@gmail.com (siduko)
Package Create Date: 2016-10-25
Package Last Update: 2016-10-25
Language: PHP
License: MIT
Last Refreshed: 2025-02-06 15:06:25
Package Statistics
Total Downloads: 7
Monthly Downloads: 0
Daily Downloads: 0
Total Stars: 0
Total Watchers: 2
Total Forks: 0
Total Open Issues: 0

Laravel 5 Activity Log

Latest Version on Packagist Software License Build Status Coverage Status Quality Score Total Downloads

This laravel 5 package provides to log the activity of users. It can also automatically log model events, custom message log. You can custom log handler to saving another destination Unless you can use built in handler as EloquentHandler (using database ) or LogHandler (using log)

Install

Via Composer

$ composer require siduko/laravel-activitylog

Or add composer.json

"require": {
    '...',
    "siduko/laravel-activitylog":"v1.0-dev"
}

Usage

Install the service provider to config.php

// config/app.php

'providers' => [
    '...',
    \LaiVu\ActivityLog\ActivityLogServiceProvider::class,
],

'aliases' => [
    '...',
    'ActivityLog'=>\LaiVu\ActivityLog\ActivityLogFacade::class,
],

You can publish the migration with:

php artisan vendor:publish --provider="LaiVu\ActivityLog\ActivityLogServiceProvider" --tag="migrations"

After you run migration

php artisan migrate

You can optionally publish the config file with:

php artisan vendor:publish --provider="LaiVu\ActivityLog\ActivityLogServiceProvider" --tag="config"

Default config

<?php
/**
 * Created by PhpStorm.
 * User: Lai Vu
 * Date: 10/24/2016
 * Time: 3:52 PM
 */

return [
    /***
     * When set to true, activity log will be active
     */
    'enabled' => env('ACTIVITY_LOGGER_ENABLED', true),

    'activity_model' => '\LaiVu\ActivityLog\Models\Activity',

    'default_log_name' => 'default',

    /***
     * Default activity log handle, using to setting log handler
     * You can custom a handler and set to here
     *  Example:
     *   'default' => ['eloquent','log','custom']
     */
    'default' => ['eloquent'],

    /**
     * When set to true, the subject returns soft deleted models.
     */
    'subject_returns_soft_deleted_models' => false,

    'delete_records_older_than_days' => 365,

    /***
     * List log handlers, you can add new custom handler
     * `driver` is classpath of log handler
     */
    'handlers' => [
        'log' => [
            'driver' => '\LaiVu\ActivityLog\Handlers\LogHandler'
        ],
        'eloquent' => [
            'driver' => '\LaiVu\ActivityLog\Handlers\EloquentHandler'
        ]
    ]
];

Basic Usage

This is the most basic way to log activity:

activity()->log('Look mum, I logged something');

Or

ActivityLog::log('Look mum, I logged something');

Change log

Please see CHANGELOG for more information what has changed recently.

Testing

$ composer test

Contributing

Please see CONTRIBUTING and CONDUCT for details.

Security

If you discover any security related issues, please email laivu.fly@gmail.com instead of using the issue tracker.

Credits

License

The MIT License (MIT). Please see License File for more information.