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.4(1mo ago)011.4k↓63.5%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 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 2w ago

READMEChangelogDependencies (25)Versions (29)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

51

—

FairBetter than 95% of packages

Maintenance90

Actively maintained with recent releases

Popularity27

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity60

Established project with proven stability

 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 ~15 days

Total

21

Last Release

56d 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

[ellaisys/aws-cognito

Laravel Authentication using AWS Cognito (Web and API)

121269.8k1](/packages/ellaisys-aws-cognito)

PHPackages © 2026

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