PHPackages                             ebola/logging - 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. [Logging &amp; Monitoring](/categories/logging)
4. /
5. ebola/logging

ActivePackage[Logging &amp; Monitoring](/categories/logging)

ebola/logging
=============

Logging for PHP 7.1 and package spatie/laravel-activitylog

v0.6.4(7y ago)0289MITPHPPHP &gt;=7.0

Since Nov 6Pushed 7y ago1 watchersCompare

[ Source](https://github.com/VSiniy/test-laravel-packages)[ Packagist](https://packagist.org/packages/ebola/logging)[ Docs](https://github.com/VSiniy/test-laravel-packages)[ RSS](/packages/ebola-logging/feed)WikiDiscussions master Synced 3d ago

READMEChangelogDependencies (1)Versions (15)Used By (0)

Save and display global logs with log activity from Laravel Activitylog v.2
===========================================================================

[](#save-and-display-global-logs-with-log-activity-from-laravel-activitylog-v2)

[![Latest Version](https://camo.githubusercontent.com/71bfa86606facd86a5607f225e00af4ed66424bf68e8f4280d41195b6bcfdc4a/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f72656c656173652f5653696e69792f746573742d6c61726176656c2d7061636b616765732e7376673f7374796c653d666c61742d737175617265)](https://github.com/VSiniy/test-laravel-packages/releases)

This Laravel &gt;=5.5 package. It provides a simple API to work with and version Laravel Activitylog. To learn all about Laravel Activitylog, head over to [the extensive documentation](https://docs.spatie.be/laravel-activitylog/v2).

Here are a few short examples of what you can do:

```
$logging = new LoggingRender();
```

It can display all user activity on front:

```
{!! $logging->renderUserLogging() !!}
```

Or display form for download users activity:

```
{!! $logging->renderDownloadLogging() !!}
```

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

[](#installation)

You can install this package via composer using this command:

```
composer require ebola/logging
```

Next, you must install the service provider:

```
// config/app.php
'providers' => [
    ...
    Ebola\Logging\LoggingServiceProvider::class,
];
```

And add aliase:

```
// config/app.php
'aliases' => [
    ...
    'LoggingRender' => Ebola\Logging\Renders\LoggingRender::class,
    'LoggingFilters' => Ebola\Logging\Helpers\Filters::class,
    'LoggingProperties' => Ebola\Logging\Helpers\Properties::class,
];
```

You must publish activitylog migration:

```
php artisan vendor:publish --provider="Spatie\Activitylog\ActivitylogServiceProvider" --tag="migrations"
```

You must migrate:

```
php artisan migrate
```

You can optionally publish the activitylog config file:

```
php artisan vendor:publish --provider="Spatie\Activitylog\ActivitylogServiceProvider" --tag="config"
```

You can publish the views with:

```
php artisan vendor:publish --provider="Ebola\Logging\LoggingServiceProvider" --tag="views"
```

You can publish the assets with:

```
php artisan vendor:publish --provider="Ebola\Logging\LoggingServiceProvider" --tag="public"
```

You can publish the translations with:

```
php artisan vendor:publish --provider="Ebola\Logging\LoggingServiceProvider" --tag="translations"
```

You can publish the config-file with:

```
php artisan vendor:publish --provider="Ebola\Logging\LoggingServiceProvider" --tag="config"
```

This is the contents of the published config file:

```
return [

    /*
     * Route prefixes for save transitions on the URL
     * 'web' is all routes without prefix
     */
    'logging_routing_prefixes' => [
        'web',
        // 'admin',
    ],

    /*
     * Save transition if route is ajax query
     */
    'logging_routing_save_ajax' => false,

    /*
     * Users events for save
     */
    'logging_users_events' => [
        'registered',
        'attempting',
        // 'authenticated',
        'login',
        'failed',
        'logout',
        'lockout',
        'password_reset',
    ],

    /*
     * Models events for save
     */
    'logging_models_events' => [
        'created',
        'updated',
        'deleted',
    ],

    /*
     * Number rows for display on one page paginate
     */
    'num_rows_on_page' => 15,

    /*
     * Path to folder where logging files are saving
     */
    'download_path' => '/reports/',

    /*
     * List of logging models fields
     */
    'logging_fields' => [
        'id',
        'log_name',
        'subject_id',
        'subject_type',
        'causer_id',
        'causer_type',
        'description',
        // 'properties',
        'created_at',
        // 'updated_at',
    ],

    /*
     * Path to translated logging fields
     * Need path to fields translates in "dot" notation
     */
    'translation_path' => null, // 'admin.logging.fields' => []

    /*
     * Filters for fields
     * Types of filter and fields for it
     */
    'logging_filters' => [
        'selectable' => [
            'log_name',
            'subject_type',
            'causer_id',
        ],

        'according_to_the_text' => [
            'created_at',
        ],
    ],
];
```

Usage
-----

[](#usage)

You can log users routing, user activity and mails:

```
// App\Providers\EventServiceProvider.php
protected $subscribe = [
    'Ebola\Logging\Listeners\RequestEventLogging',
    'Ebola\Logging\Listeners\UserEventLogging',
    'Ebola\Logging\Listeners\MailEventLogging',
];
```

You can log models events:

```
// App\Providers\AppServiceProvider.php

use Ebola\Logging\LoggingObserver;

...

public function boot()
    {
        //

        Article::observe(LoggingObserver::class);
    }
```

Display logs
------------

[](#display-logs)

You must make object of LoggingRender class. You can transfer as a parameter the user object to display only its logs, as well as a list of fields to display on the screen or save them. If the values are not transferred, you will output all the logs with the fields specified in the config file.

```
    $logging = new LoggingRender();

    // or

    $logging = new LoggingRender(\Auth::user(), ['id', 'log_name', 'description']);
```

You have two protected methods for display logs:

```
    {!! $logging->renderUserLogging() !!}

    {!! $logging->renderDownloadLogging() !!}
```

If you use rendering methods, do not forget to call css and js for the correct display:

```

```

In each of them, methods are available to retrieve records and create a file to load it

```
    // User in logging object
    $loggingUser = $this->getUser();

    // Path to download directory from config download_path
    $fileLoggingPath = $this->getFileLoggingPath();

    // Path to activity model from config activitylog.activity_model
    $activityModel = $this->getActivityModel();

    // Path to translation path from config translation_path
    $pathToTranslationFields = $this->getTranslationPath();

    // From config num_rows_on_page
    $countRowOnDisplayFromConfig = $this->logging->getRowCount();

    // Fields from object. Default from config logging_fields
    $fieldsForDisplay = $this->logging->getFields();

    // Translates from config translation_path. Default from vendor
    $translatedFieldsForDisplay = $this->logging->getTranslatedFields();

    // Returns the constructed query
    // Fields must exist in the log table and be broken according to the type of filtering in the config logging_filters
    // Default filters are empty array
    $rows = $this->logging->getRows($filters);

    // Creates a file and displays a custom save window
    $rows = $this->logging->getRows()->get()
    $this->logging->getLoggingFile($rows);
```

There are also 2 static classes to help in the output of the properties of the logged models and the display of filters

```
    // Work with json properties field from Activity model
    class Properties
    {
        public static function getProperties($activity, $flag='attributes')
        {
            $properties = $activity->properties->toArray();

            return array_key_exists($flag, $properties) ? $properties[$flag] : null;
        }

        public static function getPropertiesChanges($activity)
        {
            $attributes = self::getProperties($activity, 'attributes');
            $old        = self::getProperties($activity, 'old');

            $result = [];
            foreach ($attributes ?? [] as $key => $value) {
                if (isset($old) && ($attributes[$key] != $old[$key])) {
                    $result[] = $key;
                }
            }

            return !empty($result) ? $result : null;
        }

        public static function getPropertiesArray($model)
        {
            $attributes    = $model->getAttributes();
            $oldAttributes = $model->getOriginal();

            $properties['attributes'] = $attributes;

            $checkAttributes = false;
            foreach ($attributes as $key => $value) {
                if (!empty($oldAttributes) && ($oldAttributes[$key] != $value)) {
                    $checkAttributes = true;
                    break;
                }
            }

            if ($checkAttributes)
                $properties['old']    = $oldAttributes;

            return $properties;
        }
    }
```

```
    // Display filter if transmitted field is in array from config logging_filters
    class Filters
    {
        const SELECT_DEFAULT_KEY = 'default';

        public static function getFilter($field, $translate)
        {
            $fieldsForFilterSelect = config('logging.logging_filters.selectable');
            $fieldsForFilterText   = config('logging.logging_filters.according_to_the_text');

            if (in_array($field, $fieldsForFilterSelect)) {
                $resultHtml = self::getSelectFilter($field, $translate);
            } elseif (in_array($field, $fieldsForFilterText)) {
                $resultHtml = self::getTextFilter($field, $translate);
            } else {
                $resultHtml = null;
            }

            return $resultHtml;
        }

        private static function getSelectFilter($field, $translate)
        {
            $activityModel = config('activitylog.activity_model');

            $values = $activityModel::select([$field])->distinct()->orderBy($field)->get();

            $arrayValues[self::SELECT_DEFAULT_KEY] = $translate;
            foreach ($values as $value) {
                if (!is_null($value->{$field})) {
                    $arrayValues[$value->{$field}] = $value->{$field};
                } else {
                    $arrayValues['null'] = __('logging::logging.user_logging.undefined');
                }
            }

            return view('logging::filters._select_filter', compact('field', 'arrayValues'));
        }

        private static function getTextFilter($field, $translate)
        {
            return view('logging::filters._text_filter', compact('field', 'translate'));
        }
    }
```

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity11

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity56

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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 ~19 days

Recently: every ~57 days

Total

14

Last Release

2859d ago

PHP version history (2 changes)v0.1PHP &gt;=7.1

v0.5PHP &gt;=7.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/21687d56dd060dc8fb04d4db9f5f04dcea5a79878109bd69e406a485ff6c641c?d=identicon)[VSiniy](/maintainers/VSiniy)

---

Top Contributors

[![vshfrost](https://avatars.githubusercontent.com/u/10602699?v=4)](https://github.com/vshfrost "vshfrost (5 commits)")

---

Tags

loggingactivity

### Embed Badge

![Health badge](/badges/ebola-logging/health.svg)

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

###  Alternatives

[monolog/monolog

Sends your logs to files, sockets, inboxes, databases and various web services

21.4k964.9M7.0k](/packages/monolog-monolog)[symfony/monolog-bundle

Symfony MonologBundle

2.9k249.1M1.6k](/packages/symfony-monolog-bundle)[itsgoingd/clockwork

php dev tools in your browser

5.9k27.6M94](/packages/itsgoingd-clockwork)[sentry/sentry

PHP SDK for Sentry (http://sentry.io)

1.9k227.1M273](/packages/sentry-sentry)[sentry/sentry-symfony

Symfony integration for Sentry (http://getsentry.com)

73761.4M66](/packages/sentry-sentry-symfony)[bugsnag/bugsnag-laravel

Official Bugsnag notifier for Laravel applications.

90234.6M36](/packages/bugsnag-bugsnag-laravel)

PHPackages © 2026

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