PHPackages                             lesichkovm/laravel-advanced-model - 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. lesichkovm/laravel-advanced-model

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

lesichkovm/laravel-advanced-model
=================================

Advanced model class for Laravel

v1.9.0(4y ago)42.7k22proprietaryPHP

Since Dec 9Pushed 4y ago1 watchersCompare

[ Source](https://github.com/lesichkovm/laravel-advanced-model)[ Packagist](https://packagist.org/packages/lesichkovm/laravel-advanced-model)[ Docs](http://github.com/lesichkovm/laravel-advanced-model)[ RSS](/packages/lesichkovm-laravel-advanced-model/feed)WikiDiscussions master Synced today

READMEChangelog (9)Dependencies (1)Versions (10)Used By (2)

Laravel Advanced Model
======================

[](#laravel-advanced-model)

An advanced model for Laravel. Has out-of-the-box support for SnakeCase (Laravel's default), as well as for CamelCase field names, and enhanced primary key support - human friendly date based unique IDs, and UUIDs.

Background
----------

[](#background)

1. Snake case (snake\_case) advanced model. This is the default Laravel's model. This model uses the foillowing fields:

```
id - Identity field
created_at - When was the record created
updated_at - When was the record last modified
deleted_at - When was the record deleted (soft delete)

```

2. Camel case (CamelCase). Camel case is more readable and a bit shorter than snake case (more at [https://en.wikipedia.org/wiki/Camel\_case](https://en.wikipedia.org/wiki/Camel_case)). This model changes the default Laravel names to:

```
Id - Identity field
CreatedAt - When was the record created
UpdatedAt - When was the record last modified
DeletedAt - When was the record deleted (soft delete)

```

3. The default Laravel model uses only incremental primary keys. Though it works for basic use cases, this causes extra effort for deduping records on larger systems. A much better option is to use unique IDs. This class supports UUIDs, as well as more human friendly unique unique IDs (HUID).

Human-friendly Unique IDs (HUIDs)
---------------------------------

[](#human-friendly-unique-ids-huids)

The Human-friendly unique IDs (HUIDs) are numeric strings consisting of the date and time with a random variable length postfix. The usual length is 20, but can be increased, if more uniqueness is required. Example: 20170715081335698999

The HUIDs are less unique than UUIDs, but have more value for everyday usage:

- They do provide enough information to uniquely identify a record in 99.99% of the user cases.
- Being date based provides answer when the record was created.
- Can be ordered in ascending/descending order as they are numeric
- Unlike UUIDs are easy for humans to read, especially when separated with dashes
- Can be further transferred to other numeric bases

```
{
  "human-readable-form" : "20170715-081335-698999",
  "base10" : "20170715081335698999",
  "base16" : "117ECC67F58A0F637",
  "base32" : "MDC4D43APZUIJ",
  "base36" : "498WXQXN91ET3",
  "base62" : "O225WNTn5DL",
  "base64" : "HVindzOeFOt",
  "base75" : "3hl}S8,t*rO",
  "base100" : "kh7f8dz/Y8",
  "crockford32" : "HFV66FXCA1XHQ"
}
```

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

[](#installation)

- Using composer

```
composer require lesichkovm/laravel-advanced-model
```

Usage
-----

[](#usage)

Extend your model classes

- Using AdvancedSnakeCaseModel

```
class MyModel extends \AdvancedSnakeCaseModel {
    private $useUniqueId = true;
}
```

- Using AdvancedCamelCaseModel

```
class MyModel extends \AdvancedCamelCaseModel {
    private $useUniqueId = true;
}
```

- Human-friendly Unique ID (HUID)

```
class MyModel extends \AdvancedSnakeCaseModel {
    private $useUniqueId = true;
}
```

- Universally Unique ID (UUID)

```
class MyModel extends \AdvancedSnakeCaseModel {
    private $useUuid = true;
}
```

- Autoincrements

```
class MyModel extends \AdvancedSnakeCaseModel {
    private $incrementing = true;
}
```

Create Model and Retrieve ID
----------------------------

[](#create-model-and-retrieve-id)

- Create snake case model instance and retrieve ID

```
$instance = new MyModel;
$instance->save();

echo $instance->id;
```

- Create new camel case model instance and retrieve ID

```
$instance = new MyModel;
$instance->save();

echo $instance->Id;
```

Additional Methods
------------------

[](#additional-methods)

- chunks($perChunk)
- getConnName
- getTableName
- trash
- untrash

###  Health Score

35

—

LowBetter than 77% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity25

Limited adoption so far

Community15

Small or concentrated contributor base

Maturity69

Established project with proven stability

 Bus Factor1

Top contributor holds 94.6% 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 ~200 days

Recently: every ~238 days

Total

9

Last Release

1521d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/7744963?v=4)[Milan Lesichkov](/maintainers/lesichkovm)[@lesichkovm](https://github.com/lesichkovm)

---

Top Contributors

[![lesichkovm](https://avatars.githubusercontent.com/u/7744963?v=4)](https://github.com/lesichkovm "lesichkovm (35 commits)")[![Sinevia](https://avatars.githubusercontent.com/u/3450815?v=4)](https://github.com/Sinevia "Sinevia (2 commits)")

---

Tags

phplaravelmodeladvancedlesichkov

### Embed Badge

![Health badge](/badges/lesichkovm-laravel-advanced-model/health.svg)

```
[![Health](https://phpackages.com/badges/lesichkovm-laravel-advanced-model/health.svg)](https://phpackages.com/packages/lesichkovm-laravel-advanced-model)
```

###  Alternatives

[mongodb/laravel-mongodb

A MongoDB based Eloquent model and Query builder for Laravel

7.1k8.4M96](/packages/mongodb-laravel-mongodb)[spiritix/lada-cache

A Redis based, automated and scalable database caching layer for Laravel

592456.3k1](/packages/spiritix-lada-cache)[glushkovds/phpclickhouse-laravel

Adapter of the most popular library https://github.com/smi2/phpClickHouse to Laravel

2051.5M2](/packages/glushkovds-phpclickhouse-laravel)[yajra/laravel-oci8

Oracle DB driver for Laravel via OCI8

8793.2M25](/packages/yajra-laravel-oci8)[laravel-clickhouse/laravel-clickhouse

A ClickHouse based Eloquent model and Query builder for Laravel

20615.6k](/packages/laravel-clickhouse-laravel-clickhouse)[ymigval/laravel-model-cache

Laravel package for caching Eloquent model queries

7962.6k4](/packages/ymigval-laravel-model-cache)

PHPackages © 2026

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