PHPackages                             al3x5/laravel-psr16-cache - 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. al3x5/laravel-psr16-cache

ActiveLibrary[Caching](/categories/caching)

al3x5/laravel-psr16-cache
=========================

PSR-16 Simple Cache implementation for Laravel - Redis, Memcached, File drivers

1.0.0(7mo ago)0311MITPHPPHP ^8.2

Since Sep 24Pushed 5mo agoCompare

[ Source](https://github.com/al3x5dev/laravel-psr16-cache)[ Packagist](https://packagist.org/packages/al3x5/laravel-psr16-cache)[ RSS](/packages/al3x5-laravel-psr16-cache/feed)WikiDiscussions main Synced 1mo ago

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

Laravel PSR-16 Cache
====================

[](#laravel-psr-16-cache)

A simple and elegant implementation of the PSR-16 standard for Laravel, allowing you to use Redis, Memcached, File, and all Laravel cache drivers with a standardized interface.

---

📦 Install
---------

[](#-install)

```
composer require al3x5/laravel-psr16-cache
```

🚀 Quick Use
-----------

[](#-quick-use)

```
use Al3x5\LaravelPsr16Cache;

$cache = new LaravelPsr16Cache();

// Save data
$cache->set('user:1', ['name' => 'Juan'], 3600);

// Get data
$user = $cache->get('user:1', 'default_value');

// Check
if ($cache->has('user:1')) {
    // Do something
}

// Remove
$cache->delete('user:1');
```

💡 Features
----------

[](#-features)

- ✅ **Full PSR-16 Implementation**
- ✅ **Support for all Laravel cache drivers** (Redis, Memcached, File, Database, etc.)
- ✅ **Automatic Configuration** via Laravel
- ✅ **Simple and Standardized Interface**
- ✅ **Ideal for Libraries and Packages** that require PSR-16

🔧 Configuration
---------------

[](#-configuration)

The library automatically uses your Laravel project's cache configuration (`config/cache.php`). Simply configure your preferred cache drivers:

```
// .env
CACHE_DRIVER=redis
# or
CACHE_DRIVER=memcached
# or
CACHE_DRIVER=file
```

📚 Available Methods
-------------------

[](#-available-methods)

```
$cache->get($key, $default = null);
$cache->set($key, $value, $ttl = null);
$cache->delete($key);
$cache->clear();
$cache->getMultiple($keys, $default = null);
$cache->setMultiple($values, $ttl = null);
$cache->deleteMultiple($keys);
$cache->has($key);
```

🔄 Usage with Dependency Injection
---------------------------------

[](#-usage-with-dependency-injection)

```
use Psr\SimpleCache\CacheInterface;

class UserService
{
    public function __construct(private CacheInterface $cache) {}

    public function findUser($id)
    {
        return $this->cache->get("user:{$id}", function() use ($id) {
            return User::find($id);
        });
    }
}
```

📋 Requirements
--------------

[](#-requirements)

- PHP 8.2 or higher
- Laravel 12.x
- Redis or Memcached extension (optional, depending on the driver)

🔗 Related
---------

[](#-related)

**For PHP projects without Laravel:**👉 [mk4u/cache](https://github.com/al3x5dev/cache) - Simple implementation with APCu, File, and other drivers.

📄 License
---------

[](#-license)

MIT License - see the LICENSE file for details.

###  Health Score

35

—

LowBetter than 79% of packages

Maintenance68

Regular maintenance activity

Popularity7

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity48

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

230d ago

### Community

Maintainers

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

---

Top Contributors

[![al3x5dev](https://avatars.githubusercontent.com/u/139165436?v=4)](https://github.com/al3x5dev "al3x5dev (6 commits)")

### Embed Badge

![Health badge](/badges/al3x5-laravel-psr16-cache/health.svg)

```
[![Health](https://phpackages.com/badges/al3x5-laravel-psr16-cache/health.svg)](https://phpackages.com/packages/al3x5-laravel-psr16-cache)
```

###  Alternatives

[spatie/laravel-responsecache

Speed up a Laravel application by caching the entire response

2.8k8.2M51](/packages/spatie-laravel-responsecache)[genealabs/laravel-model-caching

Automatic caching for Eloquent models.

2.4k4.8M26](/packages/genealabs-laravel-model-caching)[mikebronner/laravel-model-caching

Automatic caching for Eloquent models.

2.4k127.1k1](/packages/mikebronner-laravel-model-caching)[laragear/cache-query

Remember your query results using only one method. Yes, only one.

272122.8k](/packages/laragear-cache-query)[iazaran/smart-cache

Smart Cache is a caching optimization package designed to enhance the way your Laravel application handles data caching. It intelligently manages large data sets by compressing, chunking, or applying other optimization strategies to keep your application performant and efficient.

2057.2k](/packages/iazaran-smart-cache)[mike-bronner/laravel-model-caching

Automatic caching for Eloquent models.

2.4k2.0k1](/packages/mike-bronner-laravel-model-caching)

PHPackages © 2026

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