PHPackages                             limanweb/eloquent-extensions - 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. limanweb/eloquent-extensions

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

limanweb/eloquent-extensions
============================

Extensions for Laravel Eloquent\\Model

v1.2.1(1y ago)05.8k↓50%MITPHPPHP ^7.2|^8.0

Since Sep 4Pushed 1y ago1 watchersCompare

[ Source](https://github.com/limanweb/eloquent-extensions)[ Packagist](https://packagist.org/packages/limanweb/eloquent-extensions)[ RSS](/packages/limanweb-eloquent-extensions/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (4)DependenciesVersions (5)Used By (0)

limanweb/eloquent-extensions
============================

[](#limanwebeloquent-extensions)

Extensions for Laravel Eloquent\\Model and other classes

- Trait **HasUserstamps** for filling userstamp fields `created_at`, `updated_at`, `deleted_at` by authorized user ID

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

[](#installation)

Run:

```
composer require "limanweb/eloquent-extension"
```

Package contents
----------------

[](#package-contents)

- /**Models**
    - /**Concerns**
        - **HasUsertimestamps.php** - trait for userstamps filling in model
        - **HasCompositePrimaryKey.php** - trait for using in model composite primary key
        - **HasBuilderConfigurator** - draft of trait to build queries with request params

Usage
-----

[](#usage)

### HasUserstamps

[](#hasuserstamps)

Add into create or update table migration fields for userstamps `created_at`, `updated_at` and `deleted_at`. For examle modify CreateUsersTable migration.

```
class CreateUsersTable extends Migration
{
    public function up()
    {
        Schema::create('users', function (Blueprint $table) {
            ...
            // add userstamps fields
            $table->bigInteger('created_by')->nullable();
            $table->bigInteger('updated_by')->nullable();
            // if SoftDeletes trait will be used in model then add deleted_by field
            // $table->bigInteger('deleted_by')->nullable();

        });
    }

    ...

}
```

In the model you must:

1. declare using of trait Limanweb\\EloquentExt\\Models\\Concerns\\HasUserstamps
2. use HasUserstamps trait in the model
3. enable userstamps by define public property `$userstamps` with `true` value

```
...

use Limanweb\EloquentExt\Models\Concerns\HasUserstamps;  // (1) declare

class User extends Authenticatable
{
    use Notifiable;
    use HasUserstamps;          // (2) use trait in the model

    public $userstamps = true;  // (3) enable userstamps

    ...
}
```

The `created_by` and `updated_by` fields in your model will now be populated in the same way as the timestamp fields when you create and update the model. If your model uses SoftDeletes traite, will also be processed field, `deleted_by`.

### HasCompositePrimaryKey

[](#hascompositeprimarykey)

In the model you must:

1. declare using of trait Limanweb\\EloquentExt\\Models\\Concerns\\HasCompositePrimaryKey
2. use HasCompositePrimaryKey trait in the model
3. set $incrementing model property as `false`
4. set $primaryKey model property as array complex primary key part names

```
...

use Limanweb\EloquentExt\Models\Concerns\HasCompositePrimaryKey;  // (1) declare trait

class Example extends Model
{

    use HasCompositePrimaryKey;         // (2) use trait in the model

    public $incrementing = false;			// (3)

    protected $primaryKey = ['part1', 'part2']; // (4)

    ...
}
```

Example of using

```
>>> $m = Example::find([65, 275]);
=> App\Example {#3837
     part1: 65,
     part2: 275,
     message: "record 65:275",
   }

>>> $m->getKey();
=> [
     65,
     275,
   ]
```

###  Health Score

36

—

LowBetter than 82% of packages

Maintenance31

Infrequent updates — may be unmaintained

Popularity22

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity66

Established project with proven stability

 Bus Factor1

Top contributor holds 80% 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 ~576 days

Total

4

Last Release

720d ago

PHP version history (2 changes)1.0.0PHP &gt;=7.2.0

v1.2.1PHP ^7.2|^8.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/be8a9bfa93eb4d34ba70ea4bfd941a0d346b67f3030248cb4b443168084eb7a1?d=identicon)[limanweb](/maintainers/limanweb)

---

Top Contributors

[![limanweb](https://avatars.githubusercontent.com/u/17918827?v=4)](https://github.com/limanweb "limanweb (8 commits)")[![ocs-laravel](https://avatars.githubusercontent.com/u/72538616?v=4)](https://github.com/ocs-laravel "ocs-laravel (2 commits)")

---

Tags

laravelmodeleloquentuserstamps

### Embed Badge

![Health badge](/badges/limanweb-eloquent-extensions/health.svg)

```
[![Health](https://phpackages.com/badges/limanweb-eloquent-extensions/health.svg)](https://phpackages.com/packages/limanweb-eloquent-extensions)
```

###  Alternatives

[shiftonelabs/laravel-cascade-deletes

Adds application level cascading deletes to Eloquent Models.

163632.1k2](/packages/shiftonelabs-laravel-cascade-deletes)[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)[phaza/single-table-inheritance

Single Table Inheritance Trait

1515.8k](/packages/phaza-single-table-inheritance)

PHPackages © 2026

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