PHPackages                             khwadj/laravel-utility-classes - 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. khwadj/laravel-utility-classes

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

khwadj/laravel-utility-classes
==============================

Collection of utility classes

0.4.0(6y ago)1347[1 PRs](https://github.com/khwadj/laravel-classes/pulls)MITPHPPHP &gt;=7.2.18

Since Aug 13Pushed 5y ago1 watchersCompare

[ Source](https://github.com/khwadj/laravel-classes)[ Packagist](https://packagist.org/packages/khwadj/laravel-utility-classes)[ Docs](https://github.com/khwadj/laravel-classes)[ RSS](/packages/khwadj-laravel-utility-classes/feed)WikiDiscussions develop Synced 2d ago

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

**DISCLAIMER : ELOQUENT FUNCTIONS OF THIS PACKAGE WILL BREAK EAGERLOADING OF BELONGSTOMANY RELATIONSHIPS**

*This package is not compatible with belongsToMany relationships due to the indexation of entries. It is recommended not to use this package until I submit a solution to index collections properly*

Utility classes for Laravel &gt;= 5.8
-------------------------------------

[](#utility-classes-for-laravel--58)

### Highest Laravel compatibily tested as of this readme : 7.9.2

[](#highest-laravel-compatibily-tested-as-of-this-readme--792)

Version 0.2 max tested compatibility : Laravel 5.8 (hard limitation &lt; 6.1.0 per composer.json)

Version 0.2.1 max tested compatibility : Laravel 5.8 (hard limitation &lt; 7.0.0 per composer.json)

Version 0.2.2 max tested compatibility : Laravel 5.8 (hard limitation &lt; 7.0.0 per composer.json)

Version 0.3 max tested compatibility : Laravel 6.2 (hard limitation &lt; 7.0.0 per composer.json)

Version 0.4 max tested compatibility : Laravel 7.9.2

Recommended version is 0.4.0 for any version of Laravel ( &gt;= 5.8 ) Minimum version usable is 0.3.0. Versions before that are not reliable and should be avoided.

### Eloquent

[](#eloquent)

Model class to extends for Models

Base Model class offers:

- runtime easy caching
    `$model = MyModel::cacheGet('myCacheKey');`
    `MyModel::cacheSet('myCacheKey', $model);`
- retrieve and cache
    `$model = MyModel::find_and_remember(1);`
- retrieve and cache as
    `MyModel::find_and_remember_as(1, 'myCacheKey');`
- retrieve if not available and cache
    `$model = MyModel::find_or_recall(1);`
- custom builder to retrieve and cache
     `MyModel::where(...)->get_and_remember_as('All_models_with_that_property');`
     `MyModel::where(...)->first_and_remember_as('One_model_with_that_property');`
     `MyModel::where(...)->first_and_remember();`

Collection as results of queries on a Model return an instance of `khwadj\Eloquent\Collection` that is indexed by primary key

**CAREFUL : THIS WILL BREAK EAGERLOADING OF BELONGSTOMANY RELATIONSHIPS**

*This package is not compatible with belongsToMany relationships due to the indexation of entries. It is recommended not to use this package until I submit a solution to index collections properly*

```
$models = MyModel::all();
// get the model with primary key = 1
$model_one = $models->get(1);

// check and retrieve from relationships
if ( $model_one->relation_many->has(555) ) {
    $related_model = $model_one->relation_many->get(555);
}

```

since 0.3.0 : retrieve from eager-loaded relationships

```
$models    = MyModel::with('relationship_many')->get();
$model_one = $models->get(1);
// check and retrieve from eager-loaded relationships
if ( $model_one->relation_many->has(555) ) {
    $related_model = $model_one->relation_many->get(555);
}

```

Note: PK is determined by `$model->getKey()` which will be empty if your model doesn't use an auto-incremented PK. You can update this function to return any unique stringable value representing your model.

### View Service Provider

[](#view-service-provider)

Simply redeclares gatherData() function to upgrade performances. In return, Renderable arguments cannot be passed to a view.

In config &gt; app.php

```
'providers' => [
        ...
        // Illuminate\View\ViewServiceProvider::class,
        \Khwadj\View\ViewServiceProvider::class,
        ...

```

###  Health Score

25

—

LowBetter than 35% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity13

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity49

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 ~53 days

Total

6

Last Release

2248d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/5187752?v=4)[Paoulo Riveros](/maintainers/Khwadj)[@khwadj](https://github.com/khwadj)

---

Top Contributors

[![khwadj](https://avatars.githubusercontent.com/u/5187752?v=4)](https://github.com/khwadj "khwadj (55 commits)")

### Embed Badge

![Health badge](/badges/khwadj-laravel-utility-classes/health.svg)

```
[![Health](https://phpackages.com/badges/khwadj-laravel-utility-classes/health.svg)](https://phpackages.com/packages/khwadj-laravel-utility-classes)
```

###  Alternatives

[markwalet/nova-modal-response

A Laravel Nova asset for Modal responses on an action.

17818.7k](/packages/markwalet-nova-modal-response)[crumbls/layup

A visual page builder plugin for Filament 5 — Divi-style grid layouts with extensible widgets.

591.7k1](/packages/crumbls-layup)[tomshaw/electricgrid

A feature-rich Livewire package designed for projects that require dynamic, interactive data tables.

119.2k](/packages/tomshaw-electricgrid)

PHPackages © 2026

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