PHPackages                             jrumbut/eloquent-memoize - 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. jrumbut/eloquent-memoize

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

jrumbut/eloquent-memoize
========================

Memoization for Eloquent (Laravel) Models

v0.1.1(7y ago)87.5k4MITPHPPHP &gt;=5.5.0CI failing

Since Jul 10Pushed 4y ago2 watchersCompare

[ Source](https://github.com/jrumbut/eloquent-memoize)[ Packagist](https://packagist.org/packages/jrumbut/eloquent-memoize)[ Docs](https://github.com/jrumbut/eloquent-memoize)[ RSS](/packages/jrumbut-eloquent-memoize/feed)WikiDiscussions master Synced 2mo ago

READMEChangelog (4)Dependencies (5)Versions (5)Used By (0)

EloquentMemoize
===============

[](#eloquentmemoize)

[![Latest Version on Packagist](https://camo.githubusercontent.com/6304ac10fe253ed0ad2dfa9370ff74444cd6fe10a4d9919744c2d5f0a8ad3390/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6a72756d6275742f656c6f7175656e742d6d656d6f697a652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/jrumbut/eloquent-memoize)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)[![Coverage Status](https://camo.githubusercontent.com/2651594259e2662e7a8d07333f3cc6e84390d14e70fe55742b5b635c264faa87/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f636f7665726167652f672f6a72756d6275742f656c6f7175656e742d6d656d6f697a652e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/jrumbut/eloquent-memoize/code-structure)[![Quality Score](https://camo.githubusercontent.com/b26b86eb4a957bb4008390d9ddc72ecf188bfedfd115a9050e701c661d09d1b4/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f6a72756d6275742f656c6f7175656e742d6d656d6f697a652e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/jrumbut/eloquent-memoize)[![Total Downloads](https://camo.githubusercontent.com/b471b7dce6da97fd3e24b43ffe54744ebda08ae69ac410b145e1d267a3d6b385/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6a72756d6275742f656c6f7175656e742d6d656d6f697a652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/jrumbut/eloquent-memoize)[![SensioLabsInsight](https://camo.githubusercontent.com/d906145190f060b21376900e7c955031b3907556a9c87796763423ad85f1651c/68747470733a2f2f696e73696768742e73656e73696f6c6162732e636f6d2f70726f6a656374732f38363837316465312d356362362d343031352d626132322d6365346338383237393734632f6d696e692e706e67)](https://insight.sensiolabs.com/projects/86871de1-5cb6-4015-ba22-ce4c8827974c)

Memoization for [Eloquent](https://laravel.com/docs/5.2/eloquent) models.

Install
-------

[](#install)

Via Composer

```
$ composer require jrumbut/eloquent-memoize
```

Usage
-----

[](#usage)

```
class MyModel extends MemoizingModel
{
    protected static $memoized = ['slow_attribute'];

    //Now only slow the first time it's accessed
    public function getSlowAttribute($value)
    {
        sleep(3);
        return ucwords($value);
    }
}
```

-or-

```
class TraitModel extends Model
{
    use Memoizes;

    /**
     * Initialize attributes
     *
     * @return void
     */
    public static function boot()
    {
        parent::boot();
        static::setMemoized(['slow']);
    }

    //Now only slow the first time it's accessed
    public function getSlowAttribute($value)
    {
        sleep(3);
        return ucwords($value);
    }
}
```

Change log
----------

[](#change-log)

Please see [CHANGELOG](CHANGELOG.md) for more information what has changed recently.

Testing
-------

[](#testing)

```
$ composer test
```

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) and [CONDUCT](CONDUCT.md) for details.

Security
--------

[](#security)

If you discover any security related issues, please email  instead of using the issue tracker.

Credits
-------

[](#credits)

- [Joshua Rumbut](https://github.com/jrumbut)
- Akihito Koriyama () for the excellent [PHP.Skeleton](https://github.com/koriym/PHP.Skeleton) package
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity26

Limited adoption so far

Community16

Small or concentrated contributor base

Maturity51

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 81.4% 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 ~260 days

Total

4

Last Release

2814d ago

### Community

Maintainers

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

---

Top Contributors

[![jrumbut](https://avatars.githubusercontent.com/u/1858391?v=4)](https://github.com/jrumbut "jrumbut (35 commits)")[![marcroberts](https://avatars.githubusercontent.com/u/43874?v=4)](https://github.com/marcroberts "marcroberts (5 commits)")[![calvinl](https://avatars.githubusercontent.com/u/490687?v=4)](https://github.com/calvinl "calvinl (1 commits)")[![JayBizzle](https://avatars.githubusercontent.com/u/340752?v=4)](https://github.com/JayBizzle "JayBizzle (1 commits)")[![xAockd](https://avatars.githubusercontent.com/u/3390348?v=4)](https://github.com/xAockd "xAockd (1 commits)")

---

Tags

laravelphplaraveleloquentmemoization

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/jrumbut-eloquent-memoize/health.svg)

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

###  Alternatives

[cviebrock/eloquent-sluggable

Easy creation of slugs for your Eloquent models in Laravel

4.0k13.6M253](/packages/cviebrock-eloquent-sluggable)[tucker-eric/eloquentfilter

An Eloquent way to filter Eloquent Models

1.8k4.8M26](/packages/tucker-eric-eloquentfilter)[watson/validating

Eloquent model validating trait.

9723.3M47](/packages/watson-validating)[cybercog/laravel-ban

Laravel Ban simplify blocking and banning Eloquent models.

1.1k651.8k11](/packages/cybercog-laravel-ban)[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)

PHPackages © 2026

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