PHPackages                             ministryofjustice/aws-secrets-cache-php - 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. ministryofjustice/aws-secrets-cache-php

ActiveLibrary[Caching](/categories/caching)

ministryofjustice/aws-secrets-cache-php
=======================================

AWS Secrets Manager caching for PHP (PSR-16, APCu cache storage, ENV-prefixed secrets).

v2.0.1(2mo ago)07.6k↓49.2%1[4 PRs](https://github.com/ministryofjustice/aws-secrets-cache-php/pulls)PHPPHP ^8.2CI passing

Since Aug 12Pushed 1mo agoCompare

[ Source](https://github.com/ministryofjustice/aws-secrets-cache-php)[ Packagist](https://packagist.org/packages/ministryofjustice/aws-secrets-cache-php)[ RSS](/packages/ministryofjustice-aws-secrets-cache-php/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (10)Versions (20)Used By (0)

aws-secrets-cache-php
=====================

[](#aws-secrets-cache-php)

Reusable helper class to fetch secrets at runtime from AWS Secrets Manager with a cache to reduce duplicate requests.

Requires a pre-configured cache implementing `StorageInterface` from [laminas-cache](https://docs.laminas.dev/laminas-cache/).

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

[](#installation)

```
composer require ministryofjustice/aws-secrets-cache-php
```

Usage
-----

[](#usage)

```
use Aws\SecretsManager\SecretsManagerClient;
use Laminas\Cache\Storage\StorageInterface;
use MoJ\AwsSecretsCache\AwsSecretsCache;

$storage = /** instanceof StorageInterface */;
$smClient = new SecretsManagerClient([...]);

$secretsCache = new AwsSecretsCache(null, $storage, $smClient);

$mySecret = $secretsCache->getValue('my-secret');
```

The first parameter optionally defines a namespace that will apply to all secrets retrieved by that instance of the class. The following example would return the secret named `namespace/my-secret`:

```
$secretsCache = new AwsSecretsCache('namespace', ...);
$myNamespacedSecret = $secretsCache->getValue('my-secret');
```

You can use `clearCache` to remove an item from the underlying cache:

```
$mySecret = $secretsCache->getValue('my-secret');

$secretsCache->clearCache('my-secret');

$mySecret = $secretsCache->getValue('my-secret'); // Will fetch from AWS again
```

TTL must be implemented on the storage class, it is not applied by `AwsSecretsCache`.

###  Health Score

49

—

FairBetter than 95% of packages

Maintenance88

Actively maintained with recent releases

Popularity26

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity57

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 62.5% 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 ~16 days

Recently: every ~7 days

Total

14

Last Release

69d ago

Major Versions

v1.1.1 → v2.0.02026-03-10

PHP version history (2 changes)1.0.0PHP ^8.1

v1.0.9PHP ^8.2

### Community

Maintainers

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

![](https://www.gravatar.com/avatar/5cf011faa73728dc15d22f1f47e20b582a951bb7a1e3358deb119d014b454cf5?d=identicon)[Greg Tyler](/maintainers/Greg%20Tyler)

---

Top Contributors

[![mohammedrmoj](https://avatars.githubusercontent.com/u/187296596?v=4)](https://github.com/mohammedrmoj "mohammedrmoj (10 commits)")[![gregtyler](https://avatars.githubusercontent.com/u/100852?v=4)](https://github.com/gregtyler "gregtyler (3 commits)")[![renovate[bot]](https://avatars.githubusercontent.com/in/2740?v=4)](https://github.com/renovate[bot] "renovate[bot] (3 commits)")

---

Tags

awscachesecrets-manager

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP\_CodeSniffer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/ministryofjustice-aws-secrets-cache-php/health.svg)

```
[![Health](https://phpackages.com/badges/ministryofjustice-aws-secrets-cache-php/health.svg)](https://phpackages.com/packages/ministryofjustice-aws-secrets-cache-php)
```

###  Alternatives

[laminas/laminas-cache

Caching implementation with a variety of storage options, as well as codified caching strategies for callbacks, classes, and output

1076.9M130](/packages/laminas-laminas-cache)[cache/adapter-common

Common classes for PSR-6 adapters

11124.4M38](/packages/cache-adapter-common)[cache/filesystem-adapter

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

705.8M82](/packages/cache-filesystem-adapter)[cache/array-adapter

A PSR-6 cache implementation using a php array. This implementation supports tags

548.3M151](/packages/cache-array-adapter)[cache/redis-adapter

A PSR-6 cache implementation using Redis (PhpRedis). This implementation supports tags

523.9M27](/packages/cache-redis-adapter)[cache/simple-cache-bridge

A PSR-6 bridge to PSR-16. This will make any PSR-6 cache compatible with SimpleCache.

423.1M27](/packages/cache-simple-cache-bridge)

PHPackages © 2026

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