PHPackages                             klsoft/yii3-cache-doctrine - 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. klsoft/yii3-cache-doctrine

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

klsoft/yii3-cache-doctrine
==========================

The package provides the PSR-16 cache using the Doctrine ORM

1.0.0(1mo ago)031MITPHP

Since Mar 16Pushed 1mo agoCompare

[ Source](https://github.com/klsoft-web/yii3-cache-doctrine)[ Packagist](https://packagist.org/packages/klsoft/yii3-cache-doctrine)[ Docs](https://github.com/klsoft-web/yii3-cache-doctrine)[ RSS](/packages/klsoft-yii3-cache-doctrine/feed)WikiDiscussions main Synced 1mo ago

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

YII3-CACHE-DOCTRINE
===================

[](#yii3-cache-doctrine)

The package provides the [PSR-16](https://www.php-fig.org/psr/psr-16/) cache using the [Doctrine ORM](https://www.doctrine-project.org/).

Requirement
-----------

[](#requirement)

- PHP 8.2 or higher.

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

[](#installation)

```
composer require klsoft/yii3-cache-doctrine
```

How to use
----------

[](#how-to-use)

### 1. [Configure](https://github.com/klsoft-web/yii3-doctrine?tab=readme-ov-file#1-configure-the-entitymanagerinterface) the EntityManagerInterface.

[](#1-configure-the-entitymanagerinterface)

### 2. Use the Doctrine console command to create or update the database schema.

[](#2-use-the-doctrine-console-command-to-create-or-update-the-database-schema)

Create the database schema:

```
APP_ENV=dev ./yii doctrine:orm:schema-tool:create
```

Update the database schema:

```
APP_ENV=dev ./yii doctrine:orm:schema-tool:update --force
```

### 3. Configure the CacheInterface.

[](#3-configure-the-cacheinterface)

```
use Yiisoft\Cache\CacheInterface;
use Yiisoft\Cache\Cache;
use Doctrine\ORM\EntityManagerInterface;
use Klsoft\Yii3CacheDoctrine\DoctrineCache;

return [
    // ...
    CacheInterface::class => static function (ContainerInterface $container) {
        return new Cache(new DoctrineCache($container->get(EntityManagerInterface::class)));
    },
];
```

### 4. Cache the data.

[](#4-cache-the-data)

Example:

```
namespace MyNamespace;

use Yiisoft\Cache\CacheInterface;

final class ProductRepository implements ProductRepositoryInterface
{
    private const TOP_PRODUCTS = 'top_poroducts';

    public function __construct(
        private CacheInterface $cache,
        private int            $cacheDuration)
    {
    }

    public function getTopProducts(int $numberOfTopProducts): array
    {
        return $this->cache->getOrSet(
            ProductRepository::TOP_PRODUCTS,
            function () use ($numberOfTopProducts) {
                return $this->getTopProductsFromDb($numberOfTopProducts);
            },
            $this->cacheDuration);
    }
}
```

###  Health Score

35

—

LowBetter than 79% of packages

Maintenance89

Actively maintained with recent releases

Popularity4

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity33

Early-stage or recently created project

 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

57d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/f4e8ac50e4ad22be84b07f4c06d28cf280d22f689c460cd385c556727e638827?d=identicon)[klsoft-web](/maintainers/klsoft-web)

---

Top Contributors

[![klsoft-web](https://avatars.githubusercontent.com/u/7967163?v=4)](https://github.com/klsoft-web "klsoft-web (1 commits)")

---

Tags

ormdoctrinecachepsr-16yii3

### Embed Badge

![Health badge](/badges/klsoft-yii3-cache-doctrine/health.svg)

```
[![Health](https://phpackages.com/badges/klsoft-yii3-cache-doctrine/health.svg)](https://phpackages.com/packages/klsoft-yii3-cache-doctrine)
```

###  Alternatives

[matthiasmullie/scrapbook

Scrapbook is a PHP cache library, with adapters for e.g. Memcached, Redis, Couchbase, APCu, SQL and additional capabilities (e.g. transactions, stampede protection) built on top.

3212.5M32](/packages/matthiasmullie-scrapbook)[desarrolla2/cache

Provides an cache interface for several adapters Apc, Apcu, File, Mongo, Memcache, Memcached, Mysql, Mongo, Redis is supported.

1322.5M47](/packages/desarrolla2-cache)[tommyknocker/pdo-database-class

Framework-agnostic PHP database library with unified API for MySQL, MariaDB, PostgreSQL, SQLite, MSSQL, and Oracle. Query Builder, caching, sharding, window functions, CTEs, JSON, migrations, ActiveRecord, CLI tools, AI-powered analysis. Zero external dependencies.

845.7k](/packages/tommyknocker-pdo-database-class)[cache/doctrine-adapter

A PSR-6 cache implementation using Doctrine. This implementation supports tags

151.0M21](/packages/cache-doctrine-adapter)[kdyby/doctrine-cache

Doctrine Cache bridge for Nette Framework

101.3M19](/packages/kdyby-doctrine-cache)

PHPackages © 2026

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