{"id":13396032,"url":"https://github.com/spatie/laravel-activitylog","last_synced_at":"2026-02-22T10:12:28.460Z","repository":{"id":9356454,"uuid":"61802818","full_name":"spatie/laravel-activitylog","owner":"spatie","description":"Log activity inside your Laravel app","archived":false,"fork":false,"pushed_at":"2025-04-22T07:32:34.000Z","size":1996,"stargazers_count":5501,"open_issues_count":12,"forks_count":724,"subscribers_count":88,"default_branch":"main","last_synced_at":"2025-05-12T02:17:12.792Z","etag":null,"topics":["audit","laravel","log","monitoring","php"],"latest_commit_sha":null,"homepage":"https://docs.spatie.be/laravel-activitylog","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/spatie.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":"docs/support-us.md","governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null},"funding":{"github":"spatie","custom":"https://spatie.be/open-source/support-us"}},"created_at":"2016-06-23T12:17:12.000Z","updated_at":"2025-05-10T18:46:11.000Z","dependencies_parsed_at":"2023-02-14T09:35:28.063Z","dependency_job_id":"5788ef49-3707-45c4-8f5f-15011b603ad8","html_url":"https://github.com/spatie/laravel-activitylog","commit_stats":{"total_commits":699,"total_committers":148,"mean_commits":4.722972972972973,"dds":0.6881258941344779,"last_synced_commit":"f95797e87e009e7d8745639e7578ffde2a081de2"},"previous_names":[],"tags_count":120,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spatie%2Flaravel-activitylog","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spatie%2Flaravel-activitylog/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spatie%2Flaravel-activitylog/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spatie%2Flaravel-activitylog/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/spatie","download_url":"https://codeload.github.com/spatie/laravel-activitylog/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253668965,"owners_count":21945056,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["audit","laravel","log","monitoring","php"],"created_at":"2024-07-30T18:00:38.042Z","updated_at":"2026-02-22T10:12:28.450Z","avatar_url":"https://github.com/spatie.png","language":"PHP","funding_links":["https://github.com/sponsors/spatie","https://spatie.be/open-source/support-us"],"categories":["Popular Packages","Uncategorized","Laravel","PHP","插件推荐"],"sub_categories":["Uncategorized"],"readme":"\u003cdiv align=\"left\"\u003e\n    \u003ca href=\"https://spatie.be/open-source?utm_source=github\u0026utm_medium=banner\u0026utm_campaign=laravel-activitylog\"\u003e\n      \u003cpicture\u003e\n        \u003csource media=\"(prefers-color-scheme: dark)\" srcset=\"https://spatie.be/packages/header/laravel-activitylog/html/dark.webp\"\u003e\n        \u003cimg alt=\"Logo for laravel-activitylog\" src=\"https://spatie.be/packages/header/laravel-activitylog/html/light.webp\"\u003e\n      \u003c/picture\u003e\n    \u003c/a\u003e\n\n\u003ch1\u003eLog activity inside your Laravel app\u003c/h1\u003e\n\n[![Latest Version on Packagist](https://img.shields.io/packagist/v/spatie/laravel-activitylog.svg?style=flat-square)](https://packagist.org/packages/spatie/laravel-activitylog)\n[![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/spatie/laravel-activitylog/run-tests.yml?branch=main\u0026label=Tests)](https://github.com/spatie/laravel-activitylog/actions/workflows/run-tests.yml)\n[![Check \u0026 fix styling](https://github.com/spatie/laravel-activitylog/workflows/Check%20\u0026%20fix%20styling/badge.svg)](https://github.com/spatie/laravel-activitylog/actions/workflows/php-cs-fixer.yml)\n[![Total Downloads](https://img.shields.io/packagist/dt/spatie/laravel-activitylog.svg?style=flat-square)](https://packagist.org/packages/spatie/laravel-activitylog)\n    \n\u003c/div\u003e\n\nThe `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.\nThe Package stores all activity in the `activity_log` table.\n\nHere's a demo of how you can use it:\n\n```php\nactivity()-\u003elog('Look, I logged something');\n```\n\nYou can retrieve all activity using the `Spatie\\Activitylog\\Models\\Activity` model.\n\n```php\nActivity::all();\n```\n\nHere's a more advanced example:\n\n```php\nactivity()\n   -\u003eperformedOn($anEloquentModel)\n   -\u003ecausedBy($user)\n   -\u003ewithProperties(['customProperty' =\u003e 'customValue'])\n   -\u003elog('Look, I logged something');\n\n$lastLoggedActivity = Activity::all()-\u003elast();\n\n$lastLoggedActivity-\u003esubject; //returns an instance of an eloquent model\n$lastLoggedActivity-\u003ecauser; //returns an instance of your user model\n$lastLoggedActivity-\u003egetExtraProperty('customProperty'); //returns 'customValue'\n$lastLoggedActivity-\u003edescription; //returns 'Look, I logged something'\n```\n\nHere's an example on [event logging](https://spatie.be/docs/laravel-activitylog/advanced-usage/logging-model-events).\n\n```php\n$newsItem-\u003ename = 'updated name';\n$newsItem-\u003esave();\n\n//updating the newsItem will cause the logging of an activity\n$activity = Activity::all()-\u003elast();\n\n$activity-\u003edescription; //returns 'updated'\n$activity-\u003esubject; //returns the instance of NewsItem that was saved\n```\n\nCalling `$activity-\u003echanges()` will return this array:\n\n```php\n[\n   'attributes' =\u003e [\n        'name' =\u003e 'updated name',\n        'text' =\u003e 'Lorum',\n    ],\n    'old' =\u003e [\n        'name' =\u003e 'original name',\n        'text' =\u003e 'Lorum',\n    ],\n];\n```\n\n## Support us\n\n[\u003cimg src=\"https://github-ads.s3.eu-central-1.amazonaws.com/laravel-activitylog.jpg?t=1\" width=\"419px\" /\u003e](https://spatie.be/github-ad-click/laravel-activitylog)\n\nWe invest a lot of resources into creating [best in class open source packages](https://spatie.be/open-source). You can support us by [buying one of our paid products](https://spatie.be/open-source/support-us).\n\nWe highly appreciate you sending us a postcard from your hometown, mentioning which of our package(s) you are using. You'll find our address on [our contact page](https://spatie.be/about-us). We publish all received postcards on [our virtual postcard wall](https://spatie.be/open-source/postcards).\n\n## Documentation\n\nYou'll find the documentation on [https://spatie.be/docs/laravel-activitylog/introduction](https://spatie.be/docs/laravel-activitylog/introduction).\n\nFind yourself stuck using the package? Found a bug? Do you have general questions or suggestions for improving the activity log? Feel free to [create an issue on GitHub](https://github.com/spatie/laravel-activitylog/issues), we'll try to address it as soon as possible.\n\n## Installation\n\nYou can install the package via composer:\n\n```bash\ncomposer require spatie/laravel-activitylog\n```\n\nThe package will automatically register itself.\n\nYou can publish the migration with:\n\n```bash\nphp artisan vendor:publish --provider=\"Spatie\\Activitylog\\ActivitylogServiceProvider\" --tag=\"activitylog-migrations\"\n```\n\n_Note_: The default migration assumes you are using integers for your model IDs. If you are using UUIDs, or some other format, adjust the format of the `subject_id` and `causer_id` fields in the published migration before continuing.\n\nAfter publishing the migration you can create the `activity_log` table by running the migrations:\n\n```bash\nphp artisan migrate\n```\n\nYou can optionally publish the config file with:\n\n```bash\nphp artisan vendor:publish --provider=\"Spatie\\Activitylog\\ActivitylogServiceProvider\" --tag=\"activitylog-config\"\n```\n\n## Changelog\n\nPlease see [CHANGELOG](CHANGELOG.md) for more information about recent changes.\n\n## Upgrading\n\nPlease see [UPGRADING](UPGRADING.md) for details.\n\n## Testing\n\n```bash\ncomposer test\n```\n\n## Contributing\n\nPlease see [CONTRIBUTING](https://github.com/spatie/.github/blob/main/CONTRIBUTING.md) for details.\n\n## Security\n\nIf you've found a bug regarding security please mail [security@spatie.be](mailto:security@spatie.be) instead of using the issue tracker.\n\n## Credits\n\n-   [Freek Van der Herten](https://github.com/freekmurze)\n-   [Sebastian De Deyne](https://github.com/sebastiandedeyne)\n-   [Tom Witkowski](https://github.com/Gummibeer)\n-   [All Contributors](../../contributors)\n\nSpecial thanks to [Ahmed Nagi](https://github.com/nagi1) for all the work he put in `v4` and to [Caneco](https://twitter.com/caneco) for the original logo.\n\n## License\n\nThe MIT License (MIT). Please see [License File](LICENSE.md) for more information.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fspatie%2Flaravel-activitylog","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fspatie%2Flaravel-activitylog","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fspatie%2Flaravel-activitylog/lists"}