PHPackages                             novay/bunny-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. [File &amp; Storage](/categories/file-storage)
4. /
5. novay/bunny-secrets

ActiveLibrary[File &amp; Storage](/categories/file-storage)

novay/bunny-secrets
===================

A Laravel filesystem driver and helper facade for Bunny.net Storage with optional Borneo Secrets Manager API key resolution.

1.1(1mo ago)082MITPHPPHP ^8.1

Since Aug 13Pushed 1mo agoCompare

[ Source](https://github.com/novay/bunny-secrets)[ Packagist](https://packagist.org/packages/novay/bunny-secrets)[ Docs](https://github.com/novay/bunny-secrets)[ RSS](/packages/novay-bunny-secrets/feed)WikiDiscussions main Synced 1w ago

READMEChangelog (3)Dependencies (11)Versions (4)Used By (0)

Bunny Secrets
=============

[](#bunny-secrets)

A small Laravel package for Bunny.net Storage with:

- automatic `bunnycdn` filesystem driver registration;
- a `BunnySecret` facade for upload, URL, exists, and delete helpers;
- optional API key resolution from **Borneo Secrets Manager**;
- safe fallback order for API keys to avoid circular filesystem boot errors.

Requirements
------------

[](#requirements)

- PHP `^8.1`
- Laravel `^10.0`, `^11.0`, `^12.0`, or `^13.0`
- `platformcommunity/flysystem-bunnycdn ^3.0`

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

[](#installation)

```
composer require novay/bunny-secrets
php artisan vendor:publish --tag=bunny-secrets-config
php artisan optimize:clear
```

Laravel package discovery will register the service provider automatically.

Environment
-----------

[](#environment)

### Recommended direct Bunny.net API key setup

[](#recommended-direct-bunnynet-api-key-setup)

Use this when you do not need Borneo Secrets Manager.

```
FILESYSTEM_DISK=local

BUNNYCDN_STORAGE_ZONE=your-storage-zone
BUNNYCDN_API_KEY=your-storage-zone-password-or-api-key
BUNNYCDN_REGION=sg
BUNNYCDN_PULL_ZONE=https://pull-zone.b-cdn.net
BUNNYCDN_CDN_URL=https://pull-zone.b-cdn.net

BORNEO_SECRET_ENABLED=false
```

### Optional Borneo Secrets Manager setup

[](#optional-borneo-secrets-manager-setup)

Turn this on only when the package should resolve the Bunny.net API key from your Borneo Secrets Manager API.

```
FILESYSTEM_DISK=local

BUNNYCDN_STORAGE_ZONE=your-storage-zone
BUNNYCDN_REGION=sg
BUNNYCDN_PULL_ZONE=https://pull-zone.b-cdn.net
BUNNYCDN_CDN_URL=https://pull-zone.b-cdn.net

BORNEO_SECRET_ENABLED=true
BORNEO_SECRET_URI=https://key.btekno.id
BORNEO_SECRET_API_KEY=your-borneo-secret-manager-api-key

BUNNY_SECRET_KEY=bunny-secrets-pass
BUNNY_SECRET_FILE=bunny_api_key.txt
BUNNY_SECRET_CACHE_FILE=true
```

Legacy env names are still supported:

```
SECRET_ENABLED=true
SECRET_URI=https://key.btekno.id
SECRET_KEY=your-borneo-secret-manager-api-key
```

API key resolution order:

1. `BUNNYCDN_API_KEY`
2. `storage/app/{BUNNY_SECRET_FILE}`
3. Borneo Secrets Manager, only when `BORNEO_SECRET_ENABLED=true`

> Recommendation: keep `FILESYSTEM_DISK=local` for Laravel and Livewire temporary uploads. Use the `bunnycdn` disk only when storing final files.

Usage
-----

[](#usage)

### Upload with the facade

[](#upload-with-the-facade)

```
use Novay\BunnySecret\BunnySecret;

$filePath = BunnySecret::uploadCDN(
    file: $request->file('photo'),
    path: 'btekno/storage',
    filename: str()->slug('bride-' . $name) . '-' . uniqid(),
);

if ($filePath === false) {
    throw new RuntimeException('Failed to upload photo to Bunny.net Storage.');
}

$url = BunnySecret::showCDN($filePath);
```

### Delete a file

[](#delete-a-file)

```
BunnySecret::deleteCDN('/btekno/storage/photo.jpg');
```

### Check file existence

[](#check-file-existence)

```
if (BunnySecret::existsCDN('/btekno/storage/photo.jpg')) {
    // file exists
}
```

### Use Laravel Storage

[](#use-laravel-storage)

```
use Illuminate\Support\Facades\Storage;

Storage::disk('bunnycdn')->put('demo/index.html', 'Hello Bunny');
$url = Storage::disk('bunnycdn')->url('demo/index.html');
Storage::disk('bunnycdn')->delete('demo/index.html');
```

Optional Borneo Secrets Manager API
-----------------------------------

[](#optional-borneo-secrets-manager-api)

The Borneo Secrets Manager feature remains available, but it is optional and disabled by default. When disabled, the package will not call the secret API during filesystem boot.

```
use Novay\BunnySecret\BunnySecret;

if (BunnySecret::hasSecretManager()) {
    $value = BunnySecret::getSecret('bunny-secrets-pass');
}

BunnySecret::storeSecret('another-key', 'secret-value');
BunnySecret::deleteSecret('another-key');
```

`storeSecret()` and `deleteSecret()` intentionally throw a clear exception when Borneo Secrets Manager is disabled or incomplete, because those are explicit write/delete actions. `getSecret()` returns `null` when the integration is disabled, not configured, or the secret cannot be resolved.

Configuration
-------------

[](#configuration)

The package publishes `config/bunnycdn.php`.

You do not need to manually add a `bunnycdn` disk to `config/filesystems.php`; the package registers it at runtime from `config/bunnycdn.php`. If you do define `filesystems.disks.bunnycdn`, your app-level values override the package defaults.

Failure behavior
----------------

[](#failure-behavior)

This package avoids the previous circular failure where the service provider tried to read the API key through Laravel's default `Storage` disk before the custom `bunnycdn` driver existed.

Current behavior:

- The `bunnycdn` driver is always registered during boot.
- Borneo Secrets Manager is disabled by default and used only when `BORNEO_SECRET_ENABLED=true`.
- Missing `storage_zone` or `api_key` throws a clear `BunnySecretException` when the disk is used.
- Facade helpers such as `uploadCDN()` catch upload errors, log context, and return `false` for backward compatibility.

Useful commands after changing config
-------------------------------------

[](#useful-commands-after-changing-config)

```
php artisan optimize:clear
php artisan package:discover
composer dump-autoload
```

License
-------

[](#license)

This package is licensed under the [MIT License](https://opensource.org/licenses/MIT).

###  Health Score

42

—

FairBetter than 88% of packages

Maintenance93

Actively maintained with recent releases

Popularity11

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity48

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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 ~168 days

Total

3

Last Release

34d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/712577?v=4)[Novianto Rahmadi](/maintainers/novay)[@novay](https://github.com/novay)

---

Top Contributors

[![novay](https://avatars.githubusercontent.com/u/712577?v=4)](https://github.com/novay "novay (4 commits)")

---

Tags

filesystemFlysystemlaravelcdnbunnysecretsbunnyCDNbunny-netborneo-secrets-manager

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/novay-bunny-secrets/health.svg)

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

###  Alternatives

[unisharp/laravel-filemanager

A file upload/editor intended for use with Laravel 5 to 10 and CKEditor / TinyMCE

2.2k3.6M90](/packages/unisharp-laravel-filemanager)[api-platform/laravel

API Platform support for Laravel

58190.1k21](/packages/api-platform-laravel)[roots/acorn

Framework for Roots WordPress projects built with Laravel components.

9922.4M146](/packages/roots-acorn)[aedart/athenaeum

Athenaeum is a mono repository; a collection of various PHP packages

265.2k](/packages/aedart-athenaeum)[psalm/plugin-laravel

Psalm plugin for Laravel

3345.4M354](/packages/psalm-plugin-laravel)[laravel/ai

The official AI SDK for Laravel.

1.1k4.6M322](/packages/laravel-ai)

PHPackages © 2026

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