PHPackages                             0377/thinkphp-activitylog - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. 0377/thinkphp-activitylog

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

0377/thinkphp-activitylog
=========================

thinkphp6.0 记录活动

V1.0(6y ago)025MiTPHPPHP &gt;=7.1.0

Since Nov 7Pushed 6y ago1 watchersCompare

[ Source](https://github.com/0377/thinkphp-activitylog)[ Packagist](https://packagist.org/packages/0377/thinkphp-activitylog)[ RSS](/packages/0377-thinkphp-activitylog/feed)WikiDiscussions master Synced 3w ago

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

Log activity inside your Thinkphp6 app
======================================

[](#log-activity-inside-your-thinkphp6-app)

The `0377/thinkphp-activitylog` package provides easy to use functions to log the activities of the users of your app. It can also automatically log model events. The Package stores all activity in the `activity_log` table.

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

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

You can retrieve all activity using the `ice\activitylog\Models\Activity` model.

```
Activity::select();
```

Here's a more advanced example:

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

$lastLoggedActivity = Activity::select()->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.

```
$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',
    ],
];
```

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

[](#installation)

You can install the package via composer:

```
composer require ice/thinkphp-activitylog
```

This is the contents of the published config file:

```
return [

    /*
     * If set to false, no activities will be saved to the database.
     */
    'enabled'                        => Env::get('ACTIVITY_LOGGER_ENABLED', true),

    /*
     * When the clean-command is executed, all recording activities older than
     * the number of days specified here will be deleted.
     */
    'delete_records_older_than_days' => 365,

    /*
     * If no log name is passed to the activity() helper
     * we use this default log name.
     */
    'default_log_name'               => 'default',

    /*
     * This model will be used to log activity.
     * It should be implements the ice\activitylog\Contracts\Activity interface
     * and extend think\Model.
     */
    'activity_model'                 => \ice\activitylog\Models\Activity::class,

    /*
     * This is the name of the table that will be created by the migration and
     * used by the Activity model shipped with this package.
     */
    'table_name'                     => 'activity_log',

];
```

License
-------

[](#license)

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

###  Health Score

24

—

LowBetter than 31% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity53

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

Unknown

Total

1

Last Release

2431d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/12230500?v=4)[Sean Bing](/maintainers/sbing)[@sbing](https://github.com/sbing)

---

Top Contributors

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

### Embed Badge

![Health badge](/badges/0377-thinkphp-activitylog/health.svg)

```
[![Health](https://phpackages.com/badges/0377-thinkphp-activitylog/health.svg)](https://phpackages.com/packages/0377-thinkphp-activitylog)
```

###  Alternatives

[illuminate/support

The Illuminate Support package.

630113.0M41.3k](/packages/illuminate-support)[spatie/holidays

Calculate public holidays

402860.1k2](/packages/spatie-holidays)[craftcms/feed-me

Import content from XML, RSS, CSV or JSON feeds into entries, categories, Craft Commerce products, and more.

293952.6k33](/packages/craftcms-feed-me)[solspace/craft-freeform

The most flexible and user-friendly form building plugin!

54681.3k19](/packages/solspace-craft-freeform)[pimcore/data-importer

Adds a comprehensive import functionality to Pimcore Datahub

46855.5k5](/packages/pimcore-data-importer)[japanese-date/japanese-date

日本の暦、祝日を取り扱うライブラリ

1610.0k](/packages/japanese-date-japanese-date)

PHPackages © 2026

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