PHPackages                             vagento/cacheable - 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. [Caching](/categories/caching)
4. /
5. vagento/cacheable

ActiveVagento-module[Caching](/categories/caching)

vagento/cacheable
=================

0.0.1(4y ago)15MITPHPPHP ^8.0

Since Dec 11Pushed 4y ago1 watchersCompare

[ Source](https://github.com/Vagento/Cacheable)[ Packagist](https://packagist.org/packages/vagento/cacheable)[ RSS](/packages/vagento-cacheable/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (1)Dependencies (1)Versions (2)Used By (0)

Vagento - Cacheable
===================

[](#vagento---cacheable)

 [![Version](https://camo.githubusercontent.com/7b14e943ef9b21021297e68c133c7aa7abeb5a788840b711d4cb539858503edc/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f76657273696f6e2d312e302e302d626c75652e7376673f63616368655365636f6e64733d32353932303030)](https://camo.githubusercontent.com/7b14e943ef9b21021297e68c133c7aa7abeb5a788840b711d4cb539858503edc/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f76657273696f6e2d312e302e302d626c75652e7376673f63616368655365636f6e64733d32353932303030) [ ![License: MIT](https://camo.githubusercontent.com/fdf2982b9f5d7489dcf44570e714e3a15fce6253e0cc6b5aa61a075aac2ff71b/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c6963656e73652d4d49542d79656c6c6f772e737667) ](https://opensource.org/licenses/MIT) [ ![Twitter: WWoshid](https://camo.githubusercontent.com/cfd4313c9152ad5116dd64ce61b68ba7b0e27e9c56cbc7e8a9cd258f336e5db7/68747470733a2f2f696d672e736869656c64732e696f2f747769747465722f666f6c6c6f772f57576f736869642e7376673f7374796c653d736f6369616c) ](https://twitter.com/WWoshid)

> This package adds cacheability to method calls. It requires the Laravel framework.

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

[](#installation)

```
composer require vagento/cacheable
```

Usage
-----

[](#usage)

Trait: **Cacheable** - Method Cacheability Add the `\Vagento\Cacheable\Traits\Cacheable` trait to any class that needs the results of a method call to be cached.

```
use Vagento\Cacheable\Traits\Cacheable;

class MyClass
{
    use Cacheable; // Add this trait

    public function myMethod()
    {
        // Big computational task
        return $bigData;
    }
}
```

Now you can call your method with the 'Cached' suffix like this:

```
$myClass = new MyClass();

$result = $myClass->myMethodCached();
```

Optional parameters can be passed before the method call (Can be chained):

```
$myClass = new MyClass();

// Optional: Cache usage, will toggle caching on or off
// Default: true
$myClass->setCacheUsage(false);

// Optional: Laravel cache tags @see https://laravel.com/docs/8.x/cache#cache-tags
// Default: null
$myClass->setCacheTags('my-method-tag');

// Optional: Time to live
// Default: null
$myClass->setTtl(60);
$myClass->setTtl(Carbon::now()->addMinutes(30)->toDateTime());

// Chaining
$result = $myClass->setCacheUsage(true)->setCacheTags(['method', 'something-else'])->setTtl(60)->myMethodCached();
```

For IDE support you can add the `@method` annotation to your class like this:

```
/**
 * @method array myMethodCached()
 */
class MyClass
{
    use Cacheable;

    public function myMethod(): array
    {
        // Big computational task
        return $bigData;
    }
}
```

Show your support
-----------------

[](#show-your-support)

Give a ⭐️ if this project helped you!

📝 License
---------

[](#-license)

Copyright © 2021 [Valentin Wotschel](https://github.com/WalterWoshid).
This project is [MIT](https://opensource.org/licenses/MIT) licensed.

###  Health Score

21

—

LowBetter than 18% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity5

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity44

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

Unknown

Total

1

Last Release

1619d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/37f7c13a71918329aa63e5e3a28b121d26442ce1668a731bb00005dd972d134a?d=identicon)[WalterWoshid](/maintainers/WalterWoshid)

---

Top Contributors

[![WalterWoshid](https://avatars.githubusercontent.com/u/36635504?v=4)](https://github.com/WalterWoshid "WalterWoshid (1 commits)")

### Embed Badge

![Health badge](/badges/vagento-cacheable/health.svg)

```
[![Health](https://phpackages.com/badges/vagento-cacheable/health.svg)](https://phpackages.com/packages/vagento-cacheable)
```

###  Alternatives

[imanghafoori/laravel-widgetize

A minimal yet powerful package to give a better structure and caching opportunity for your Laravel apps.

909137.9k12](/packages/imanghafoori-laravel-widgetize)[swayok/alternative-laravel-cache

Replacements for Laravel's redis and file cache stores that properly implement tagging idea. Powered by cache pool implementations provided by http://www.php-cache.com/

202541.1k6](/packages/swayok-alternative-laravel-cache)[alexmg86/laravel-sub-query

Laravel subquery

7538.4k](/packages/alexmg86-laravel-sub-query)[laravel-enso/rememberable

Model caching dependency for Laravel Enso

2863.2k25](/packages/laravel-enso-rememberable)[byerikas/cache-tags

Allows for Redis/Valkey cache flushing multiple tagged items by a single tag.

1413.9k](/packages/byerikas-cache-tags)

PHPackages © 2026

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