PHPackages                             dzaki236/logging-services - 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. dzaki236/logging-services

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

dzaki236/logging-services
=========================

Library for simplify logging laravel and manage log txt, Simple to use, based on data

2.0.3(4y ago)0106MITPHPPHP &gt;=7.2.0

Since Mar 9Pushed 4y ago1 watchersCompare

[ Source](https://github.com/dzaki236/logging-services)[ Packagist](https://packagist.org/packages/dzaki236/logging-services)[ RSS](/packages/dzaki236-logging-services/feed)WikiDiscussions master Synced today

READMEChangelog (7)Dependencies (1)Versions (8)Used By (0)

logging-services
================

[](#logging-services)

Package for logging activities, Simple to use!..

Installation Step
-----------------

[](#installation-step)

Install the package by the following command,

```
$ composer require dzaki236/logging-services
```

Dump Autoloading
----------------

[](#dump-autoloading)

Autoloading the package by the following command,

```
$ composer dump-autoload
```

Add Provider `(some case it's step is optional)`
------------------------------------------------

[](#add-provider-some-case-its-step-is-optional)

Add the provider to your `config/app.php` into `provider` section if using lower version of laravel,

```
'providers' => [
   ...
   /*
   * Package Service Providers...
   */

   Dzaki236\LoggingServices\LoggingServicesServiceProvider::class,
   ...
]
```

Add Facade `(this is optional part)`
------------------------------------

[](#add-facade-this-is-optional-part)

Add the Facade to your `config/app.php` into `aliases` section on the last part,

```
'aliases'=>[
   ...
   'LoggingServices'=>Dzaki236\LoggingServices\LoggingServices::class,
]
```

Publish the Assets
------------------

[](#publish-the-assets)

Run the following command to publish config file,

```
$ php artisan logging-services:publish
```

Run migration
-------------

[](#run-migration)

if you want to use a table on your logs just run :

```
$ php artisan migrate
```

Or if you want to reset all of your migrations `(with your data seeder)`, just run :

```
$ php artisan migrate:fresh --seed
```

Relationship `(Optional Part)`
------------------------------

[](#relationship-optional-part)

If you want to use a relationship to user on table on your logs table just add by the following code on models `LogActivity.php`:

### Version 7+-

[](#version-7-)

```
public function user()
    {
        # code...
        return $this->belongsTo('App\User','user_id');
    }
```

### Version 8.x+

[](#version-8x)

```
public function user()
    {
        # code...
        return $this->belongsTo(User::class,'user_id');
    }
```

Don't forget to add this stuff (namespacing) at first line `(before class on model)` on relationship:

```
use App\Models\User;
```

And then if you want to use `(eager-loading)` ,example on code:

```
LogActivity::with('user')->all();
```

Change Limit of flush?
======================

[](#change-limit-of-flush)

Some times you want to custom a value of limit on flushing log, On folder `config` in laravel project at `logservices.php`,change by following code `(config/logservices.php)`:

```
return [
    ....
   'flush' => TRUE,  // change this for activate / disactivated flush (default = true)
   'limit' => 1000, // change this for limit you want to flush
];
```

How To Use?
===========

[](#how-to-use)

First, add `__construct()` line at first of your controller example : `(UserController or whatever Controller it is)`;

```
// use App\Services\LogActivitiesServices\MainLogActivitiesServices; // You can use namespacing like this at first line before class on contoller

   /**
     * Display a listing of the resource.
     *
     * @return void
     */
    public function __construct(MainLogActivitiesServices $logs) {
        ...
        $this->loging = $logs; // variable name (optional)

    }

    /*
    Or, just write the source like this by following code (without namespacing) :
    */

   /**
     * Display a listing of the resource.
     *
     * @return void
     */
    public function __construct(\App\Services\LogActivitiesServices\MainLogActivitiesServices $logs) {
        ...
        $this->loging = $logs; // variable name (optional)

    }
```

Second, example on `(UserController Or Controller You have)`, add code by the following code :

```
// Example at store function on controller
public function store(Request $request)
    {
        //if
        $data = new Student($request->all());
        $con = $data->save();
        if ($con) {
            # code...
        $this->loging->activitylog(true,'add student data'); // if success set to true
            return redirect()->route('students.index')->with(['success'=>'Success!']);
        } else {
            # code...
        $this->loging->activitylog(false,'add student data'); // if had failure on proccess set to false
            return redirect()->route('students.index')->with(['error'=>'Failure!']);
        }

    }

// Example at update function on controller
    public function update($id,Request $request)
    {
        //if
        $data = Student::find($id)
        $data->update($request->all());
        $con = $data->save();
        if ($con) {
            # code...
        $this->loging->activitylog(true,'success update student data'); // if success set to true
            return redirect()->route('students.index')->with(['success'=>'Success!']);
        } else {
            # code...
        $this->loging->activitylog(false,'failure update student data'); // if had failure on proccess set to false
            return redirect()->route('students.index')->with(['error'=>'Failure!']);
        }

    }
```

Function Parameter
==================

[](#function-parameter)

All Function Parameter by the following and fill on this `can't be random fill!!, must be sequential`:

\#ParameterFielddefaultdescriptionnullablemust added on parameters1statustrue or falsetrueif success parameter set to `true` the result will be `success`,but if `false` then result will be `failed`noyes2msglogsstringstring (not nullable)message logs, write message according to the relevan conditions, but you want tonoyes3flushtrue or falsetrueif true it will be activated flushyesno, but some case yes4limit flushint (1-n)1000if true it will be activated flushyesno, but some case yes5dumptrue or falsetrueif true it will be stored to logactivities fileyesno, but some case maybe you need### License

[](#license)

The MIT License (MIT). Please see License File for more information, version of 2.0.2

##### `If had a problem or issue on older version,Please use of the latest version`

[](#if-had-a-problem-or-issue-on-older-versionplease-use-of-the-latest-version)

More Feature's here!
--------------------

[](#more-features-here)

Custom File Config (Logging)
============================

[](#custom-file-config-logging)

New update on 2.0.2 the author add new txt reader,you can use this for your custom log on your controller ^&gt;, First Step you must make config / log config txt file if do not,you will got error :).

Example following by this bellow code :
---------------------------------------

[](#example-following-by-this-bellow-code-)

```
public function store(Request $request)
    {
        //if
        $data = new Student($request->all());
        $con = $data->save();
        if ($con) {
            # code...
        $this->loging->activitylog(true,'add student data');
        // loging services this is optional, if you want to record a some log activities on your project but somehow you need it or not.

        /* try this */
        $config = new \Dzaki236\LoggingServices\FileServicesConfig('config.txt');
        // the models allowed a constructor to open a new config file (by default : at public path),jsust following the code.

        $config->fieldInsert($field,$fill);
        /*$field = Field To Scaffolding at txt file!*/
        /*$fill = fill this with value (default: request value)*/

        // For example anyway field id you can use at some case!..
        $config->fieldInsert(array('id','name','class','email'),array($data->id,$request->name,$request->class,$request->email));

            return redirect()->route('students.index')->with(['success'=>'Success!']);
        } else {
            # code...
        $this->loging->activitylog(false,'add student data'); // if had failure on proccess set to false
            return redirect()->route('students.index')->with(['error'=>'Failure!']);
        }

    }
```

By default at the version under 2.0.2 you cannot save a txt file of loging, but today you can!,by default at 2.0.2 you allowed to do a save some txt files,like example author had a input txt file on `logactivities.txt` at public file on laravel project!,but you can custom file or make a new path custom config, by use a boilerplate class construct, All Function / Parameter at boilerplate Class,just by the following and see on this `can't be random fill!!, must be sequential`:

On model `FileServicesConfig` `constructor` = `YES` !
=====================================================

[](#on-model-fileservicesconfig-constructor--yes-)

\#FunctionExplanationpath of file on models constructorAliasesnullablenamespacing free1fieldInsertThis function to fill a txt or some config file on your public folderpublic of `laravel_project/public``txt` and no more like than `txt`,just `txt`True,if you want to make alias of object for sure!yes,but somecase `no`
### On `config.txt` file (example)

[](#on-configtxt-file-example)

By default maybe you allowed to randomly fields but not recomended, at first you must fix, what field you want to fill,by default of your version.

```
name|class|email
jhondoe|12Ab|jhondoe@gmail.com
```

Mistake's warning
=================

[](#mistakes-warning)

Library has own stable test,if got error its maybe must check the code in twice, and now this is example code wrong and true

```
# Wrong code

/*
* Do not use return something else before library loaded!.
* just see some an example's here
*/

# wrong example
... action ...
$data = Model::create($request->all());
return $data;// return some from action
$this->logvariables->activitilog(true,'message logs here');
$files = new \Dzaki236\LoggingServices\FileServicesConfig('vendorlogs.txt');
$files->fieldInsert(['field1','field2','field3'],[$request->field1,$request->field2,$request->field3]);
}

# right example
... action ...
$data = Model::create($request->all());
$this->logvariables->activitilog(true,'message logs here');
$files = new \Dzaki236\LoggingServices\FileServicesConfig('vendorlogs.txt');
$files->fieldInsert(['field1','field2','field3'],[$request->field1,$request->field2,$request->field3]);
return $data;// return some from action here
}
```

Closure : `You must done a some proses and you can return a result of you want`.

### License

[](#license-1)

The MIT License (MIT). Please see [License](https://github.com/dzaki236/logging-services/blob/master/LICENSE) File for more information, version of 2.0.2

###  Health Score

23

—

LowBetter than 27% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity48

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 ~5 days

Total

7

Last Release

1492d ago

Major Versions

1.0.3 → 2.0.02022-03-11

### Community

Maintainers

![](https://www.gravatar.com/avatar/91801cf2a4195fe0a7ae2a288db31172114f0c7648f08adff1ae7e1358c8bcf1?d=identicon)[dzaki236](/maintainers/dzaki236)

---

Top Contributors

[![dzaki236](https://avatars.githubusercontent.com/u/61301953?v=4)](https://github.com/dzaki236 "dzaki236 (84 commits)")

---

Tags

laravellaravel-logginglogginglogphplaravellaravel-loggingphp-logginglogging-serviceslogging-laravel

### Embed Badge

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

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

###  Alternatives

[spatie/laravel-activitylog

A very simple activity logger to monitor the users of your website or application

5.8k45.4M309](/packages/spatie-laravel-activitylog)[sentry/sentry-laravel

Laravel SDK for Sentry (https://sentry.io)

1.3k114.3M154](/packages/sentry-sentry-laravel)[yadahan/laravel-authentication-log

Laravel Authentication Log provides authentication logger and notification for Laravel.

416632.8k5](/packages/yadahan-laravel-authentication-log)[inspector-apm/inspector-laravel

Code Execution Monitoring, built for developers.

2332.0M2](/packages/inspector-apm-inspector-laravel)[hedii/laravel-gelf-logger

A Laravel package to send logs to a gelf compatible backend like graylog

1333.4M10](/packages/hedii-laravel-gelf-logger)[larabug/larabug

Laravel 6.x/7.x/8.x/9.x/10.x/11.x/12.x/13.x bug notifier

299549.3k1](/packages/larabug-larabug)

PHPackages © 2026

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