PHPackages                             robjbrain/laravel-user-timestamps - 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. robjbrain/laravel-user-timestamps

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

robjbrain/laravel-user-timestamps
=================================

Drop in replacements for UserTimestamps and SoftDeletes to also store the authenticated user id.

01281PHP

Since Jun 23Pushed 3y ago1 watchersCompare

[ Source](https://github.com/robjbrain/laravel-user-timestamps)[ Packagist](https://packagist.org/packages/robjbrain/laravel-user-timestamps)[ RSS](/packages/robjbrain-laravel-user-timestamps/feed)WikiDiscussions master Synced yesterday

READMEChangelogDependenciesVersions (1)Used By (0)

Laravel User Timestamps
=======================

[](#laravel-user-timestamps)

This is a drop in replacement for `HasTimestamps` trait in Laravel. It will add the additional fields. `created_by_id` and `updated_by_id` of the user that performed the operation.

It also supports polymorphic relationship which will add `created_by_type` and `updated_by_type` fields.

It also has support for `SoftDeletes` replacing Laravel's built in `SoftDeletes` trait to include `deleted_by_id` for the user who performed the soft delete.

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

[](#installation)

You can install the package via composer:

```
composer require robjbrain/laravel-user-timestamps
```

Usage
-----

[](#usage)

Add the `CacheMutationsTrait` trait to a model you like to cache the mutations of.

```
use Robjbrain\LaravelUserTimestamps\HasUserTimestamps;
use Robjbrain\LaravelUserTimestamps\UserSoftDeletes;

class YourEloquentModel extends Model
{
    use HasUserTimestamps;
    use UserSoftDeletes;

    // This will behave the same UserTimestamps
    public $timestamps = true;

    // This will utilise the updated_by_id and created_by_id fields
    public $userTimestamps = true;

    // This will utilise the updated_by_type and created_by_type fields
    public $polymorphicTimestamps = true;

    // This will utilise the deleted_by_id field
    public $userSoftDeletes = true;

    // This will utilise the deleted_by_type field
    public $polymorphicSoftDeletes = true;
}
```

If you are using `$polymorphicTimestamps` you don't need to set `$userTimestamps` or `$timestamps` to true.

If you are using `$userTimestamps` you do not need to set `$timestamps` to true.

###  Health Score

17

—

LowBetter than 6% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity11

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity25

Early-stage or recently created project

 Bus Factor1

Top contributor holds 50% 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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/43d875ab7d8eb6de0e9570d0f6fa71d66301260ff1614a4f74ccf84eac172006?d=identicon)[robjbrain](/maintainers/robjbrain)

---

Top Contributors

[![freezedriedpop](https://avatars.githubusercontent.com/u/349616?v=4)](https://github.com/freezedriedpop "freezedriedpop (3 commits)")[![robjbrain](https://avatars.githubusercontent.com/u/10143910?v=4)](https://github.com/robjbrain "robjbrain (3 commits)")

### Embed Badge

![Health badge](/badges/robjbrain-laravel-user-timestamps/health.svg)

```
[![Health](https://phpackages.com/badges/robjbrain-laravel-user-timestamps/health.svg)](https://phpackages.com/packages/robjbrain-laravel-user-timestamps)
```

PHPackages © 2026

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