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.1.3(1w ago)010.4k↓63.6%1[1 issues](https://github.com/ministryofjustice/aws-secrets-cache-php/issues)[5 PRs](https://github.com/ministryofjustice/aws-secrets-cache-php/pulls)PHPPHP ^8.2CI passing

Since Aug 12Pushed 4d 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 2d ago

READMEChangelogDependencies (20)Versions (27)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

52

—

FairBetter than 96% of packages

Maintenance99

Actively maintained with recent releases

Popularity26

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity59

Maturing project, gaining track record

 Bus Factor2

2 contributors hold 50%+ of commits

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

Total

20

Last Release

11d 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 (6 commits)")[![renovate[bot]](https://avatars.githubusercontent.com/in/2740?v=4)](https://github.com/renovate[bot] "renovate[bot] (4 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (1 commits)")[![mattmachell](https://avatars.githubusercontent.com/u/1550722?v=4)](https://github.com/mattmachell "mattmachell (1 commits)")[![sixdaysandy](https://avatars.githubusercontent.com/u/5802072?v=4)](https://github.com/sixdaysandy "sixdaysandy (1 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

1077.3M154](/packages/laminas-laminas-cache)[sabre/cache

Simple cache abstraction layer implementing PSR-16

551.3M5](/packages/sabre-cache)[voku/simple-cache

Simple Cache library

332.7M10](/packages/voku-simple-cache)[graham-campbell/bounded-cache

A Bounded TTL PSR-16 Cache Implementation

112.1M10](/packages/graham-campbell-bounded-cache)

PHPackages © 2026

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