Search by

neclimdul / drupal-psr6

neclimdul

PSR6 wrapper for Drupal Caches.

Package info

gitlab.com/neclimdul/drupal-psr6

Homepage

Issues

pkg:composer/neclimdul/drupal-psr6

Statistics

Installs: 2

Dependents: 0

Suggesters: 0

Stars: 0

1.0.0 2026-09-09 20:03 UTC

This package is auto-updated.

Last update: 2026-09-10 01:16:54 UTC


README

This library wraps Drupal's CacheBackends and exposes them as PSR6 CachePools for libraries. This allows to use existing Drupal cache configuration for libraries that expose cache interfaces using PSR6.

Usage

You should be able to create a pool using any cache backend and cache tag invalidator from Drupal's DI Container.

Example using Firebase JWT:

use Drupal\Component\Datetime\Time;
use Drupal\Core\Cache\MemoryBackend;
use NecLimDul\DrupalPsr6\DrupalCacheItemPool;
use Firebase\JWT\CachedKeySet;
use Firebase\JWT\JWT;

// Replace backend and cache validator with real implementations.
$backend = new MemoryBackend(new Time());
$keySet = new CachedKeySet(
    'https://example.com/',
    new GuzzleHttp\Client(),
    new GuzzleHttp\Psr7\HttpFactory(),
    new DrupalCacheItemPool(
       $this->backend,
       $this->backend,
    ),
);

Help and docs

TODO

Installing Drupal PSR6

You can install using composer.

composer require neclimdul/drupal-psr6