PHPackages                             battis/lazy-secrets - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. battis/lazy-secrets

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

battis/lazy-secrets
===================

A (thin) wrapper for google/cloud-secret-manager to reduce boilerplate

v1.1(2y ago)0632[1 PRs](https://github.com/battis/lazy-secrets/pulls)1Apache-2.0PHPCI passing

Since Nov 23Pushed 1mo ago1 watchersCompare

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

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

Lazy Secrets
============

[](#lazy-secrets)

[![Latest Version](https://camo.githubusercontent.com/cda7645ef9be710b27c5632f3d91fefe07522d6c24f9c24d1154fa46f4310f0f/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6261747469732f6c617a792d736563726574732e737667)](https://packagist.org/packages/battis/lazy-secrets)

A (thin) wrapper for google/cloud-secret-manager to reduce boilerplate

Install
-------

[](#install)

```
composer require battis/lazy-secrets
```

Use
---

[](#use)

```
use Battis\LazySecrets\Secrets;

$data = Secrets::get("MY_APP_SECRET");
```

Background
----------

[](#background)

While the [Google Cloud Secret Manager](https://cloud.google.com/secret-manager/docs)is a fine way to store (and access) app secrets, it also entails a bunch of boilerplate code that I don't want to fat finger. So, instead of writing...

```
use Google\Cloud\SecretManager\V1\SecretManagerServiceClient;

$client = new SecretManagerServiceClient();
$project = $_ENV["GOOGLE_CLOUD_PROJECT"];
$key = "MY_APP_SECRET";
$version = "latest";
$secret = $client->accessSecretVersion(
  "projects/$project/secrets/$key/versions/$version"
);
$data = $secret->getPayload()->getData();

// and even (if you're packing a lot into one secret)
$obj = json_decode($data);

// ...and then using the $data or $obj
```

...I'd rather just write:

```
use Battis\LazySecrets\Secrets;

$data = Secrets::get("MY_APP_SECRET");

// or
Secrets::init($project, true);
$obj = Secrets::get("MY_APP_SECRET");
```

Alternatively, a PSR-16 Simple Cache implementation is also available (for easy use with dependency injection):

```
use Battis\LazySecrets\Cache;

// assume that the `GOOGLE_CLOUD_PROJECT` environment variable is set
$secrets = new Cache();

$obj = $secrets->get("MY_APP_SECRET");
```

or

```
/** src/Example/DependencyConsumer */

namespace Example;

use Psr\SimpleCache\CacheInterface;

class DependencyConsumer
{
  public function __constructor(CacheInterface $cache)
  {
    // ...
  }
}
```

```
/** src/app.php */

$container = new DI\Container([
  Psr\SimpleCache\CacheInterface::class => DI\create(
    \Battis\LazySecrets\Cache::class
  ),
]);
$consumer = $container->get(DependencyConsumer::class);
```

###  Health Score

37

—

LowBetter than 82% of packages

Maintenance64

Regular maintenance activity

Popularity13

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity50

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 76.6% 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 ~155 days

Total

4

Last Release

795d ago

Major Versions

v0.2 → v1.02024-03-03

### Community

Maintainers

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

---

Top Contributors

[![battis](https://avatars.githubusercontent.com/u/419619?v=4)](https://github.com/battis "battis (36 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (11 commits)")

---

Tags

google-cloudsecret-manager

### Embed Badge

![Health badge](/badges/battis-lazy-secrets/health.svg)

```
[![Health](https://phpackages.com/badges/battis-lazy-secrets/health.svg)](https://phpackages.com/packages/battis-lazy-secrets)
```

###  Alternatives

[mobiledetect/mobiledetectlib

Mobile\_Detect is a lightweight PHP class for detecting mobile devices. It uses the User-Agent string combined with specific HTTP headers to detect the mobile environment.

10.7k159.4M428](/packages/mobiledetect-mobiledetectlib)[illuminate/contracts

The Illuminate Contracts package.

704122.9M10.0k](/packages/illuminate-contracts)[phiki/phiki

Syntax highlighting using TextMate grammars in PHP.

3573.0M23](/packages/phiki-phiki)[civicrm/civicrm-core

Open source constituent relationship management for non-profits, NGOs and advocacy organizations.

728272.9k17](/packages/civicrm-civicrm-core)[flow-php/etl

PHP ETL - Extract Transform Load - Abstraction

374468.4k50](/packages/flow-php-etl)[gehrisandro/tailwind-merge-php

TailwindMerge for PHP merges multiple Tailwind CSS classes by automatically resolving conflicts between them

1391.5M9](/packages/gehrisandro-tailwind-merge-php)

PHPackages © 2026

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