PHPackages                             madhurasri/laravel-activitylog-mongodb - 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. [Database &amp; ORM](/categories/database)
4. /
5. madhurasri/laravel-activitylog-mongodb

ActiveLibrary[Database &amp; ORM](/categories/database)

madhurasri/laravel-activitylog-mongodb
======================================

This is an extended version of the popular spatie/laravel-activitylog package designed to store data in MongoDB databases.

1.0.1(3y ago)0376MITPHPPHP ^8.0

Since Dec 20Pushed 3y agoCompare

[ Source](https://github.com/madhurasri/laravel-activitylog-mongodb)[ Packagist](https://packagist.org/packages/madhurasri/laravel-activitylog-mongodb)[ Docs](https://github.com/spatie/activitylog)[ Fund](https://spatie.be/open-source/support-us)[ GitHub Sponsors](https://github.com/spatie)[ RSS](/packages/madhurasri-laravel-activitylog-mongodb/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (2)Dependencies (7)Versions (3)Used By (0)

[![Social Card of Laravel Activity Log](/art/socialcard.png)](/art/socialcard.png)

Log activity inside your Laravel app with MongoDB support
=========================================================

[](#log-activity-inside-your-laravel-app-with-mongodb-support)

[![Latest Version on Packagist](https://camo.githubusercontent.com/d7aaca9f2f19a6a63eddb1fdcfa1f2d0941fcbc14e3d28c6c9bb3ddfdfbe7043/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6d6164687572617372692f6c61726176656c2d61637469766974796c6f672d6d6f6e676f64622e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/madhurasri/laravel-activitylog-mongodb)[![GitHub Workflow Status](https://camo.githubusercontent.com/e73e76c6e91106fb66a3d7c8a0b3008e43dc1185ea690e32f0dc4559038a8f22/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f776f726b666c6f772f7374617475732f6d6164687572617372692f6c61726176656c2d61637469766974796c6f672d657874656e6465642f72756e2d74657374733f6c6162656c3d7465737473)](https://github.com/madhurasri/laravel-activitylog-mongodb/actions/workflows/run-tests.yml)[![Check & fix styling](https://github.com/madhurasri/laravel-activitylog-mongodb/workflows/Check%20&%20fix%20styling/badge.svg)](https://github.com/madhurasri/laravel-activitylog-mongodb/actions/workflows/php-cs-fixer.yml)[![Total Downloads](https://camo.githubusercontent.com/d96fdb8e0fad2eaa371ae185ee8b10e9cd9cb5ed5179b44cd7d7346bf8c4b53a/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6d6164687572617372692f6c61726176656c2d61637469766974796c6f672d6d6f6e676f64622e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/madhurasri/laravel-activitylog-mongodb)

This is an extended version of the popular `spatie/laravel-activitylog` package which allows you to easily log activities of your Laravel applications, such as user logins, profile updates, and more. It can also automatically log model events. This extended package allows you to store all activity in a MongoDB collection.

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

[](#installation)

You can install the package via composer:

```
composer require madhurasri/laravel-activitylog-mongodb
```

The package will automatically register itself.

You can publish the config file with:

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

Usage
-----

[](#usage)

Here's a demo of how you can use it:

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

You can retrieve all activity using the `Madhurasri\Activitylog\Models\Activity` model.

```
Activity::all();
```

Here's a more advanced example:

```
activity()
   ->performedOn($anEloquentModel)
   ->causedBy($user)
   ->withProperties(['customProperty' => 'customValue'])
   ->log('Look, I logged something');

$lastLoggedActivity = Activity::all()->last();

$lastLoggedActivity->subject; //returns an instance of an eloquent model
$lastLoggedActivity->causer; //returns an instance of your user model
$lastLoggedActivity->getExtraProperty('customProperty'); //returns 'customValue'
$lastLoggedActivity->description; //returns 'Look, I logged something'
```

Here's an example on [event logging](https://spatie.be/docs/laravel-activitylog/advanced-usage/logging-model-events).

```
$newsItem->name = 'updated name';
$newsItem->save();

//updating the newsItem will cause the logging of an activity
$activity = Activity::all()->last();

$activity->description; //returns 'updated'
$activity->subject; //returns the instance of NewsItem that was saved
```

Calling `$activity->changes()` will return this array:

```
[
   'attributes' => [
        'name' => 'updated name',
        'text' => 'Lorum',
    ],
    'old' => [
        'name' => 'original name',
        'text' => 'Lorum',
    ],
];
```

Documentation
-------------

[](#documentation)

You'll find the documentation of original package on .

Find yourself stuck using the package? Found a bug? Do you have general questions or suggestions for improving the activity log mongodb pakcage? Feel free to [create an issue on GitHub](https://github.com/madhurasri/laravel-activitylog-mongodb/issues), we'll try to address it as soon as possible.

Testing
-------

[](#testing)

```
composer test
```

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information about recent changes.

Credits
-------

[](#credits)

- [Freek Van der Herten](https://github.com/freekmurze)
- [Sebastian De Deyne](https://github.com/sebastiandedeyne)
- [Tom Witkowski](https://github.com/Gummibeer)
- [All Contributors](../../contributors)

And a special thanks to [Caneco](https://twitter.com/caneco) for the logo and [Ahmed Nagi](https://github.com/nagi1) for all the work he put in `v4`.

Support spatie
--------------

[](#support-spatie)

Spatie invest a lot of resources into creating [best in class open source packages](https://spatie.be/open-source). You can support them by [buying one of their paid products](https://spatie.be/open-source/support-us).

License
-------

[](#license)

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

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity12

Limited adoption so far

Community19

Small or concentrated contributor base

Maturity52

Maturing project, gaining track record

 Bus Factor2

2 contributors hold 50%+ of commits

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

Total

2

Last Release

1238d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/aa7d941201b77768439046670fb779927f0a154ba7c1a6304b9843fb154ba348?d=identicon)[madhurasri](/maintainers/madhurasri)

---

Top Contributors

[![Gummibeer](https://avatars.githubusercontent.com/u/6187884?v=4)](https://github.com/Gummibeer "Gummibeer (282 commits)")[![freekmurze](https://avatars.githubusercontent.com/u/483853?v=4)](https://github.com/freekmurze "freekmurze (230 commits)")[![nagi1](https://avatars.githubusercontent.com/u/16584220?v=4)](https://github.com/nagi1 "nagi1 (35 commits)")[![AlexVanderbist](https://avatars.githubusercontent.com/u/6287961?v=4)](https://github.com/AlexVanderbist "AlexVanderbist (23 commits)")[![mallardduck](https://avatars.githubusercontent.com/u/619938?v=4)](https://github.com/mallardduck "mallardduck (11 commits)")[![stevebauman](https://avatars.githubusercontent.com/u/6421846?v=4)](https://github.com/stevebauman "stevebauman (10 commits)")[![ReeceM](https://avatars.githubusercontent.com/u/2767904?v=4)](https://github.com/ReeceM "ReeceM (10 commits)")[![akoSalman](https://avatars.githubusercontent.com/u/17239230?v=4)](https://github.com/akoSalman "akoSalman (8 commits)")[![laravel-shift](https://avatars.githubusercontent.com/u/15991828?v=4)](https://github.com/laravel-shift "laravel-shift (8 commits)")[![AbdullahFaqeir](https://avatars.githubusercontent.com/u/1428547?v=4)](https://github.com/AbdullahFaqeir "AbdullahFaqeir (7 commits)")[![AdrianMrn](https://avatars.githubusercontent.com/u/12762044?v=4)](https://github.com/AdrianMrn "AdrianMrn (7 commits)")[![leMaur](https://avatars.githubusercontent.com/u/2118799?v=4)](https://github.com/leMaur "leMaur (6 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (4 commits)")[![mvdnbrk](https://avatars.githubusercontent.com/u/802681?v=4)](https://github.com/mvdnbrk "mvdnbrk (4 commits)")[![sebastiandedeyne](https://avatars.githubusercontent.com/u/1561079?v=4)](https://github.com/sebastiandedeyne "sebastiandedeyne (4 commits)")[![rubenvanassche](https://avatars.githubusercontent.com/u/619804?v=4)](https://github.com/rubenvanassche "rubenvanassche (4 commits)")[![patinthehat](https://avatars.githubusercontent.com/u/5508707?v=4)](https://github.com/patinthehat "patinthehat (4 commits)")[![grantholle](https://avatars.githubusercontent.com/u/1189456?v=4)](https://github.com/grantholle "grantholle (3 commits)")[![eduarguz](https://avatars.githubusercontent.com/u/14934055?v=4)](https://github.com/eduarguz "eduarguz (3 commits)")[![pacoorozco](https://avatars.githubusercontent.com/u/2443200?v=4)](https://github.com/pacoorozco "pacoorozco (3 commits)")

---

Tags

logspatielaraveluseractivitymongodb

###  Code Quality

TestsPest

### Embed Badge

![Health badge](/badges/madhurasri-laravel-activitylog-mongodb/health.svg)

```
[![Health](https://phpackages.com/badges/madhurasri-laravel-activitylog-mongodb/health.svg)](https://phpackages.com/packages/madhurasri-laravel-activitylog-mongodb)
```

###  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)

PHPackages © 2026

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