PHPackages                             velitsol/userstamps - 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. [Database &amp; ORM](/categories/database)
4. /
5. velitsol/userstamps

AbandonedArchivedLibrary[Database &amp; ORM](/categories/database)

velitsol/userstamps
===================

A simple package to insert and load userstamps for a model automatically, it provides an eloquent trait to use in your models.

v0.1.7(6y ago)331.2k2[1 issues](https://github.com/hmshafeeq/userstamps/issues)MITPHPPHP &gt;=5.6.0

Since Sep 2Pushed 6y ago2 watchersCompare

[ Source](https://github.com/hmshafeeq/userstamps)[ Packagist](https://packagist.org/packages/velitsol/userstamps)[ RSS](/packages/velitsol-userstamps/feed)WikiDiscussions master Synced 2mo ago

READMEChangelogDependencies (1)Versions (9)Used By (0)

Laravel Eloquent Userstamps
===========================

[](#laravel-eloquent-userstamps)

[![GitHub issues](https://camo.githubusercontent.com/e158745455c980a50845d6382faf33f7138e1a823e989c0a5cbb2bbfb0fb7b07/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6973737565732f686d736861666565712f757365727374616d70732e737667)](https://github.com/hmshafeeq/userstamps/issues)[![GitHub forks](https://camo.githubusercontent.com/29e1ce9fbd698a79a7f04ef3b2323d204240a25dcf615febce16cecb67aeb199/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f666f726b732f686d736861666565712f757365727374616d70732e737667)](https://github.com/hmshafeeq/userstamps/network)[![GitHub stars](https://camo.githubusercontent.com/d119d54687fb10d9f5be2d021e4dbf24869df22674b9d4692a774b7c98258e0b/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f73746172732f686d736861666565712f757365727374616d70732e737667)](https://github.com/hmshafeeq/userstamps/stargazers)

### A simple package to load &amp; insert userstamps for a model

[](#a-simple-package-to-load--insert-userstamps-for-a-model)

Requirements
------------

[](#requirements)

- This package requires PHP 5.6+
- It works with Laravel 5.4 or later (and may work with earlier versions too).

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

[](#installation)

Step 1: Install Through Composer

```
composer require velitsol/userstamps

```

Step 2: Add the Service Provider

```
// config/app.php

'providers' => [
    '...',
     VelitSol\Userstamps\UserstampServiceProvider::class
];
```

Usage
-----

[](#usage)

Load the trait in your model and see the magic.

#### Scenario 1 : Load Userstamps For A Model

[](#scenario-1--load-userstamps-for-a-model)

You can configure this package to autoload the userstamp along with your model. This will be the case when userstamp is being set in controller or some where else manually.

```
use VelitSol\Userstamps\UserstampTrait;

class Post extends Model {

    use UserstampTrait;

    protected $userstamps = [
       'created_by',
       'updated_by',
       'submitted_by',
       'deleted_by'
    ];
}
```

And then you can autoload these userstamps like,

```
$posts = Post::withUserstamps()->get();
```

This will allow you to access the defined userstamps on your model as dynamic relationships

```
$post->createdByUser;
$post->updatedByUser;
$post->submittedByUser;
$post->deletedByUser;
```

#### Scenario 2 : Insert &amp; Load Userstamps For A Model

[](#scenario-2--insert--load-userstamps-for-a-model)

You can configure this package to handle the userstamp insertion behind the scenes. This will also load those userstamps when you will fetch the records with eloquent. Auto insert will depend on,

1. Event ('creating', 'saving', 'updating', 'deleting')
2. Field
3. Expression

```
use VelitSol\Userstamps\UserstampTrait;

class Post extends Model {

    use UserstampTrait;

    protected $userstamps = [
       // This userstamp should be set when 'creating' event is invoked.
       'created_by' => [
            'depends_on_event' => 'creating',
       ],
       // This userstamp should be set when 'creating' or 'updating' event is invoked.
       // This is an example, if a userstamp depends on multiple events
       'updated_by' => [
            'depends_on_event' => ['creating', 'updating'],
       ],
       'deleted_by' => [
             'depends_on_event' => 'deleting',
       ],

       // This userstamp should be set if "is_archived" is dirty (has some change in value)
       'archived_by' => [
            'depends_on_field' => 'is_archived'
       ],

       // This userstamp should be set if "updating" event is invoked on this model,
       // and "is_submitted" is dirty (has some change in value)
       'submitted_by'=> [
            'depends_on_event' => 'updating',
            'depends_on_field' => 'is_submitted'
       ],

       // This userstamp should be set if "updating" event is invoked on this model,
       // and provided expression evaluates to true
       'suspended_by' => [
          'depends_on_event' => 'updating',
          'depends_on_expression' => '$api_hits > 100' // $api_hits is a model field i.e $model->api_hits
       ],
       .............,
       ..............,
    ];
}
```

And then you can autoload these userstamps like,

```
$posts = Post::withUserstamps()->get();
```

This will allow you to access the defined userstamps on your model as dynamic relationships

```
$post->createdByUser;
$post->updatedByUser;
$post->archivedByUser;
$post->submittedByUser;
$post->suspendedByUser;
```

License
-------

[](#license)

This open-source software is licensed under the [MIT license](https://opensource.org/licenses/MIT).

###  Health Score

29

—

LowBetter than 60% of packages

Maintenance19

Infrequent updates — may be unmaintained

Popularity25

Limited adoption so far

Community9

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

Every ~72 days

Recently: every ~116 days

Total

8

Last Release

2304d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/6695370?v=4)[Muhammad Shafeeq](/maintainers/hmshafeeq)[@hmshafeeq](https://github.com/hmshafeeq)

---

Top Contributors

[![hmshafeeq](https://avatars.githubusercontent.com/u/6695370?v=4)](https://github.com/hmshafeeq "hmshafeeq (19 commits)")

---

Tags

eloquentlaravelphptraituserstampslaraveleloquentuserstampscreated\_byupdated\_by

### Embed Badge

![Health badge](/badges/velitsol-userstamps/health.svg)

```
[![Health](https://phpackages.com/badges/velitsol-userstamps/health.svg)](https://phpackages.com/packages/velitsol-userstamps)
```

###  Alternatives

[wildside/userstamps

Laravel Userstamps provides an Eloquent trait which automatically maintains `created\_by` and `updated\_by` columns on your model, populated by the currently authenticated user in your application.

7511.7M13](/packages/wildside-userstamps)[cybercog/laravel-love

Make Laravel Eloquent models reactable with any type of emotions in a minutes!

1.2k302.7k1](/packages/cybercog-laravel-love)[cviebrock/eloquent-taggable

Easy ability to tag your Eloquent models in Laravel.

567694.8k3](/packages/cviebrock-eloquent-taggable)[reedware/laravel-relation-joins

Adds the ability to join on a relationship by name.

2121.2M13](/packages/reedware-laravel-relation-joins)[highsolutions/eloquent-sequence

A Laravel package for easy creation and management sequence support for Eloquent models with elastic configuration.

121130.3k](/packages/highsolutions-eloquent-sequence)[toponepercent/baum

Baum is an implementation of the Nested Set pattern for Eloquent models.

3154.7k](/packages/toponepercent-baum)

PHPackages © 2026

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