PHPackages                             gjentii/laravel-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. gjentii/laravel-userstamps

ActiveLibrary

gjentii/laravel-userstamps
==========================

Laravel Blueprint macros for userStamps and dropUserStamps (created\_by, updated\_by, deleted\_by).

00PHP

Since Sep 2Pushed 8mo agoCompare

[ Source](https://github.com/Gjentii/user_stamps)[ Packagist](https://packagist.org/packages/gjentii/laravel-userstamps)[ RSS](/packages/gjentii-laravel-userstamps/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

Laravel UserStamps
==================

[](#laravel-userstamps)

Blueprint macros that add `created_by`, `updated_by`, and `deleted_by` columns to your migrations, plus a trait that auto-fills them on create/update/delete/restore.

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

[](#installation)

If you see “could not be found in any version,” Composer cannot locate the package on Packagist. Use one of these options:

1. Local path (fastest for development)

Add a path repository in your app’s `composer.json` (the `url` points to where this package folder lives relative to your app):

```
{
  "repositories": [
    { "type": "path", "url": "../user_stamps" }
  ]
}
```

Examples: `../user_stamps`, `../packages/laravel-userstamps`, or any relative/absolute path that matches your folder structure.

Then require it as a normal semver version (this package declares `0.1.0` for path installs):

```
composer require gjentii/laravel-userstamps:^0.1.0
```

2. Git/VCS repository (no Packagist)

Push this repo to Git (GitHub, GitLab, etc.) and add a VCS repository in your app’s `composer.json`:

```
{
  "repositories": [
    { "type": "vcs", "url": "https://github.com/your-username/laravel-userstamps.git" }
  ]
}
```

- Preferred: create a tag in this repo, e.g. `v0.1.0`, then:

```
composer require gjentii/laravel-userstamps:^0.1.0
```

- If you haven’t tagged yet, require the branch and allow dev stability:

```
composer require gjentii/laravel-userstamps:dev-main --no-update
composer config minimum-stability dev
composer config prefer-stable true
composer update gjentii/laravel-userstamps -W
```

Alternative: alias the branch as a stable version without changing your project-wide stability:

```
{
  "require": {
    "gjentii/laravel-userstamps": "dev-main as 0.1.0"
  }
}
```

3. Publish to Packagist (recommended for public use)

- Push the repo to a public Git remote.
- Create a Git tag: `v0.1.0` (Composer derives versions from tags).
- Submit the repository URL on `https://packagist.org/packages/submit`.
- Then in your app:

```
composer require gjentii/laravel-userstamps
```

The package uses Laravel auto-discovery. No manual provider registration needed.

Troubleshooting Composer stability:

- Path installs use the `version` field in this package and resolve as stable.
- VCS/Packagist installs ignore the `version` field and use Git tags. Tag a release (e.g., `v0.1.0`) or require `dev-main` with appropriate stability settings as shown above.

Usage
-----

[](#usage)

In any migration, call the macros on the Blueprint `$table`:

```
Schema::create('things', function (Blueprint $table) {
    $table->id();
    // ... your columns
    $table->userStamps(); // adds created_by, updated_by, deleted_by (nullable, unsignedBigInteger)
    $table->timestamps();
});
```

To drop them in `down()` or later migrations:

```
$table->dropUserStamps();
```

Attach the `UserStamps` trait to any Eloquent model you want to auto-populate the columns:

```
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes; // if applicable
use Gjentii\UserStamps\Traits\UserStamps;

class Post extends Model
{
    use SoftDeletes; // optional, but enables deleted_by handling
    use UserStamps;  // auto-sets created_by, updated_by, deleted_by
}
```

Behavior:

- On `creating`: sets `created_by` and `updated_by` to `Auth::id()` if authenticated
- On `updating`: sets `updated_by` to `Auth::id()` if authenticated
- On `deleting` with SoftDeletes: sets `deleted_by` to `Auth::id()` and saves quietly
- On `restoring` with SoftDeletes: clears `deleted_by`

Relationships included on the trait:

```
$model->createdBy();
$model->updatedBy();
$model->deletedBy();
```

The user model class is resolved from `config('auth.providers.users.model')` (falls back to `App\\Models\\User`).

Namespacing
-----------

[](#namespacing)

If you prefer a different namespace/vendor, change these values:

- `composer.json` -&gt; `name`: `your-username/laravel-userstamps`
- `composer.json` -&gt; `autoload.psr-4`: `Gjentii\\UserStamps\\`
- `src/UserStampsServiceProvider.php` -&gt; namespace `Gjentii\\UserStamps`
- `src/Traits/UserStamps.php` -&gt; namespace `Gjentii\\UserStamps\\Traits`

Then run `composer dump-autoload`.

License
-------

[](#license)

MIT

###  Health Score

16

—

LowBetter than 5% of packages

Maintenance43

Moderate activity, may be stable

Popularity0

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity13

Early-stage or recently created project

 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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/528071a41a43b10d336906ce177bfbcd0ece57d970371d71867c998d77bea211?d=identicon)[Gjentii](/maintainers/Gjentii)

---

Top Contributors

[![Gjentii](https://avatars.githubusercontent.com/u/142898279?v=4)](https://github.com/Gjentii "Gjentii (6 commits)")

### Embed Badge

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

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

PHPackages © 2026

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