PHPackages                             icm-services/activity-log - 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. icm-services/activity-log

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

icm-services/activity-log
=========================

Fork of regulus/Activity-log for Laravel 6.

v0.6.8(9y ago)05MITPHPPHP &gt;=5.4.0

Since Jul 26Pushed 6y agoCompare

[ Source](https://github.com/ICM-Services/ActivityLog)[ Packagist](https://packagist.org/packages/icm-services/activity-log)[ RSS](/packages/icm-services-activity-log/feed)WikiDiscussions master Synced 3d ago

READMEChangelogDependencies (2)Versions (17)Used By (0)

ActivityLog
===========

[](#activitylog)

**A simple and clean Laravel 5 activity logger for monitoring user activity on a website or web application.**

- [Installation](#installation)
- [Basic Usage](#basic-usage)
- [Advanced Usage](#advanced-usage)
- [Getting Linked Content](#linked-content)
- [Displaying Action Icons](#action-icons)

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

[](#installation)

**Basic installation, service provider registration, and aliasing:**

To install ActivityLog, make sure "regulus/activity-log" has been added to Laravel 5's `composer.json` file.

```
"require": {
	"regulus/activity-log": "0.6.*"
},

```

Then run `php composer.phar update` from the command line. Composer will install the ActivityLog package. Now, all you have to do is register the service provider and set up ActivityLog's alias. In `app/config/app.php`, add this to the `providers` array:

```
Regulus\ActivityLog\ActivityLogServiceProvider::class,

```

And add this to the `aliases` array:

```
'Activity' => Regulus\ActivityLog\Models\Activity::class,

```

**Publishing migrations and configuration:**

To publish this package's configuration and migrations, run this from the command line:

```
php artisan vendor:publish

```

You will now be able to edit the config file in `config/log.php` if you wish to customize the configuration of ActivityLog.

> **Note:** Migrations are only published; remember to run them when ready.

To run migration to create ActivityLog's table, run this from the command line:

```
php artisan migrate

```

Basic Usage
-----------

[](#basic-usage)

**Logging user activity:**

```
	Activity::log([
		'contentId'   => $user->id,
		'contentType' => 'User',
		'action'      => 'Create',
		'description' => 'Created a User',
		'details'     => 'Username: '.$user->username,
		'updated'     => (bool) $id,
	]);
```

The above code will log an activity for the currently logged in user. The IP address will automatically be saved as well and the `developer` flag will be set if the user has a `developer` session variable set to `true`. This can be used to differentiate activities between the developer and the website administrator. The `updated` boolean, if set to `true`, will replace all instances of "Create" or "Add" with "Update" in the `description` and `details` fields.

Advanced Usage
--------------

[](#advanced-usage)

As of version `0.6.0`, ActivityLog has built in the ability to dynamically create descriptions based on language keys in Laravel's language files. If you would like to enable this feature without having to set `language_key` to `true` when you use the `log()` function, change `defaults.language_key` to `true` in the config file (it is not present by default so you will have to add it).

**Logging user activity with language keys:**

```
	Activity::log([
		'contentType' => 'Record',
		'description' => [
			'created_items', [ // "activity-log::descriptions.created_items" is ":user created :number :items."
				'number' => 2,
				'items'  => 'SPL|labels.record', // "labels.record" in this example has a string of "Record|Records"
			],
		],
		'details' => [
			'record',
			'This is Some Kind of Record',
		],
		'data' => [
			'category' => 'Content',
		],
	]);

	echo $activity->getDescription(); // may output "Unknown User created 2 records."

	echo $activity->getDetails(); // may output "Record: This is Some Kind of Record"

	echo $activity->getData('category'); // will output "Content"
```

In the example above, the `items` replacement variable in the description has a number of specified properties before the `|` character which separates them from the actual language variable. The available properties are as follows:

```
S - Return the "singular" string (in the case of "labels.record", "Record")
P - Return the "plural" string (in the case of "labels.record", "Records")
A - Prepend the string with "a" or "an" (example: "a record" instead of just "record")
L - Convert the string to lowercase

```

In our example above, you will see both singular ("S") and plural ("P") are being used. When both are used, the description builder looks for a `number` replacement variable to decide whether the singular or plural form should be used.

> **Note:** The `user` replacement variable is automatically set based on the record's user ID.

Getting Linked Content
----------------------

[](#getting-linked-content)

**Set up the `content_types` config array like the following example:**

```
	'item' => [
		'uri'       => 'view/:id',
		'subdomain' => 'items',
		'model'     => 'App\Models\Item',
	],
```

You can use `getContentItem()` to get the item based on the specified model (assuming, in the case of the above specified example, that your content type is set to "Item"). You can also use `getUrl()` to get the URL of the content item or `getLinkedDescription()` to get a linked description for the item.

Displaying Action Icons
-----------------------

[](#displaying-action-icons)

**Display an action icon based on config setup:**

```
	echo $activity->getIconMarkup();
```

You can also use `getIcon()` to get just the icon class from which to build your own icon markup.

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity56

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 87.3% 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 ~66 days

Recently: every ~51 days

Total

16

Last Release

3314d ago

PHP version history (2 changes)v0.3.0PHP &gt;=5.3.0

v0.5.1PHP &gt;=5.4.0

### Community

Maintainers

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

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

---

Top Contributors

[![Regulus343](https://avatars.githubusercontent.com/u/967717?v=4)](https://github.com/Regulus343 "Regulus343 (55 commits)")[![dimamarkus](https://avatars.githubusercontent.com/u/2600729?v=4)](https://github.com/dimamarkus "dimamarkus (2 commits)")[![evias](https://avatars.githubusercontent.com/u/141805?v=4)](https://github.com/evias "evias (1 commits)")[![moura137](https://avatars.githubusercontent.com/u/1171111?v=4)](https://github.com/moura137 "moura137 (1 commits)")[![syphernl](https://avatars.githubusercontent.com/u/639906?v=4)](https://github.com/syphernl "syphernl (1 commits)")[![danikp](https://avatars.githubusercontent.com/u/3479747?v=4)](https://github.com/danikp "danikp (1 commits)")[![thujohn](https://avatars.githubusercontent.com/u/580699?v=4)](https://github.com/thujohn "thujohn (1 commits)")[![dansup](https://avatars.githubusercontent.com/u/877217?v=4)](https://github.com/dansup "dansup (1 commits)")

### Embed Badge

![Health badge](/badges/icm-services-activity-log/health.svg)

```
[![Health](https://phpackages.com/badges/icm-services-activity-log/health.svg)](https://phpackages.com/packages/icm-services-activity-log)
```

###  Alternatives

[overtrue/laravel-query-logger

A dev tool to log all queries for laravel application.

413307.5k6](/packages/overtrue-laravel-query-logger)[regulus/activity-log

A clean and simple Laravel 5 activity logger for monitoring user activity on a website or web application.

164220.1k2](/packages/regulus-activity-log)[guanguans/laravel-exception-notify

Monitor exception and report to the notification channels(Log、Mail、AnPush、Bark、Chanify、DingTalk、Discord、Gitter、GoogleChat、IGot、Lark、Mattermost、MicrosoftTeams、NowPush、Ntfy、Push、Pushback、PushBullet、PushDeer、PushMe、Pushover、PushPlus、QQ、RocketChat、ServerChan、ShowdocPush、SimplePush、Slack、Telegram、WeWork、WPush、XiZhi、YiFengChuanHua、ZohoCliq、ZohoCliqWebHook、Zulip).

14642.7k1](/packages/guanguans-laravel-exception-notify)

PHPackages © 2026

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