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 6d 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

23

—

LowBetter than 27% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity52

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

2383d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/b094d6477950b29604ad2b66078a431ed7ac5532f377fbe3bb8c3f3f2c9f486d?d=identicon)[sbing](/maintainers/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

[ashallendesign/short-url

A Laravel package for creating shortened URLs for your web apps.

1.4k1.9M4](/packages/ashallendesign-short-url)[intervention/zodiac

Zodiac Sign Calculator

58191.7k](/packages/intervention-zodiac)[erlandmuchasaj/laravel-gzip

Gzip your responses.

40129.3k2](/packages/erlandmuchasaj-laravel-gzip)

PHPackages © 2026

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