登录 注册

laravel-activitylog

去点 Star
开发者工具
5,915
Stars
—
Forks
0
Watchers
—
Open Issues
待补全
许可证
PHP
语言
—
创建时间
最近更新

项目能做什么

在 Laravel 应用中记录用户活动与事件日志的扩展包。
来源:基于仓库元数据 · 内容以仓库实际 README 为准

使用说明 查看原始 README 原仓库文档

中文使用说明暂未生成。下面保留原仓库 README 摘录,命令与配置均以原文为准。
原始 README 摘录(英文原文,节选前 3000 字符)
<div align="left">
    <a href="https://spatie.be/open-source?utm_source=github&utm_medium=banner&utm_campaign=laravel-activitylog">
      <picture>
        <source media="(prefers-color-scheme: dark)" srcset="https://spatie.be/packages/header/laravel-activitylog/html/dark.webp">
        <img alt="Logo for laravel-activitylog" src="https://spatie.be/packages/header/laravel-activitylog/html/light.webp">
      </picture>
    </a>

<h1>Log activity inside your Laravel app</h1>

[![Latest Version on Packagist](https://img.shields.io/packagist/v/spatie/laravel-activitylog.svg?style=flat-square)](https://packagist.org/packages/spatie/laravel-activitylog)
[![GitHub Workflow Status](https://github.com/spatie/laravel-activitylog/actions/workflows/run-tests.yml/badge.svg)](https://github.com/spatie/laravel-activitylog/actions/workflows/run-tests.yml)
[![Check & fix styling](https://github.com/spatie/laravel-activitylog/workflows/Check%20&%20fix%20styling/badge.svg)](https://github.com/spatie/laravel-activitylog/actions/workflows/php-cs-fixer.yml)
[![Total Downloads](https://img.shields.io/packagist/dt/spatie/laravel-activitylog.svg?style=flat-square)](https://packagist.org/packages/spatie/laravel-activitylog)
    
</div>

The `spatie/laravel-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:

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

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

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

Here's a more advanced example:

```php
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->getProperty('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).

```php
$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->attribute_changes` will return this collection:

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

## Support us

[<img src="https://spatie.be/github-ad-image/laravel-activitylog.jpg" width="419px" />](https://spatie.be/github-a
阅读完整原文

项目深度分析 规则生成(AI 未配置)

综合评分 44.4 分。该项目在“个人可实施性”维度得 47 分,“付费可能性”维度得 20.0 分,差异化空间 70.0 分(评分依据见评分卡)。

面向细分需求的二次开发产品

产品构想基于 laravel-activitylog 的核心能力,聚焦一个更窄的场景(如某平台、某行业)做差异化。
目标用户该细分场景用户
难度/周期中 · 2~6 周
收费模式买断制 / 订阅制 / 广告
竞争风险细分需求规模需验证
依据 AI 推测:基于项目主题标签的判断
以上为规则引擎基于仓库公开数据生成的参考结论,包含推测成分,不构成投资或创业承诺;配置 AI 后可获得更深入的分析。
报告会保存到 个人中心

竞品与相似项目 GitHub Search 真实检索

项目中文简介Stars语言
MuhammadSadeeq/laravel-activitylog-ui 中文介绍暂未生成
A beautiful, modern UI for Spatie's Activity Log with advanc
197 PHP
alexjustesen/filament-spatie-laravel-activitylog 中文介绍暂未生成
View your Spatie Laravel activity logs inside of Filament.
79 PHP
swisnl/filament-activitylog 中文介绍暂未生成
Filament integration for spatie/laravel-activitylog
17 PHP
nowshad7/laravel-activitylog-ui 中文介绍暂未生成
A beautiful, drop-in Tailwind CSS dashboard for Spatie Larav
16 PHP
damms005/laravel-activitylog-ui 中文介绍暂未生成
A Voyager-powered UI for the spatie/laravel-activitylog pack
6 PHP
以上为通过 GitHub 官方 Search API 检索的相似项目,功能差异与优劣势需进一步人工确认,配置 AI 后可生成对比分析。

项目优势与风险

技术成熟度创建时间待补全,最近推送 ,发布过 100 个 Release
社区活跃Star 5,915 / Fork 0 / Issue 0(数据支持,可自行核实)
许可证未检测到(需人工确认)
主要风险上游项目方向可能变化;同赛道竞争者较多(见竞品表);热度与需求不完全等价

安装与使用

此项目未提供 Docker 镜像,安装步骤以原仓库 README 为准(涉及依赖安装与环境配置,对新手门槛较高)。