PHPackages                             cesurapp/storage-bundle - 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. cesurapp/storage-bundle

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

cesurapp/storage-bundle
=======================

Symfony storage bundle

1.2.6(2mo ago)04091MITPHPPHP &gt;=8.4CI passing

Since Dec 2Pushed 2mo ago1 watchersCompare

[ Source](https://github.com/cesurapp/storage-bundle)[ Packagist](https://packagist.org/packages/cesurapp/storage-bundle)[ Docs](https://github.com/cesurapp/storage-bundle)[ RSS](/packages/cesurapp-storage-bundle/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (10)Dependencies (7)Versions (13)Used By (1)

Storage Bundle
==============

[](#storage-bundle)

[![App Tester](https://github.com/cesurapp/storage-bundle/actions/workflows/testing.yaml/badge.svg)](https://github.com/cesurapp/storage-bundle/actions/workflows/testing.yaml)[![Software License](https://camo.githubusercontent.com/e99b24ac55a940bfbc522043865b6e8934548d8524587e0d1540d163ca9e85b3/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f6c6f676f3d556e6c6963656e7365)](LICENSE.md)

Symfony file storage abstraction bundle with support for local and cloud storage providers.

- **No database dependency** - Pure file storage operations
- **S3-compatible** - Uses [async-aws/s3](https://github.com/async-aws/aws) for cloud storage
- **Multiple devices** - Configure and use multiple storage providers simultaneously
- **Fully tested** - Complete test coverage for all drivers

Supported Drivers
-----------------

[](#supported-drivers)

- **Local** - Filesystem-based storage
- **Cloudflare R2** - S3-compatible object storage
- **BackBlaze B2** - S3-compatible object storage

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

[](#installation)

Requires **Symfony 8** and **PHP 8.4+**

```
composer require cesurapp/storage-bundle
```

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

[](#configuration)

Create `config/packages/storage.yaml`:

```
storage:
  default: main  # Default storage device
  devices:
    # Local filesystem storage
    local:
      driver: local
      root: "%kernel.project_dir%/storage/files"

    # Cloudflare R2 storage
    main:
      driver: cloudflare
      root: /
      accessKey: "your_access_key"
      secretKey: "your_secret_key"
      bucket: "your_bucket_name"
      region: "auto"
      endPoint: "https://your-account-id.r2.cloudflarestorage.com"

    # BackBlaze B2 storage
    backblaze:
      driver: backblaze
      root: /
      accessKey: "your_key_id"
      secretKey: "your_application_key"
      bucket: "your_bucket_name"
      region: "us-west-001"  # See BackBlaze regions
```

### Available Regions (BackBlaze)

[](#available-regions-backblaze)

```
use Cesurapp\StorageBundle\Driver\BackBlaze;

BackBlaze::US_WEST_001;      // us-west-001
BackBlaze::US_WEST_002;      // us-west-002
BackBlaze::US_WEST_003;      // us-west-003
BackBlaze::US_WEST_004;      // us-west-004
BackBlaze::EU_CENTRAL_001;   // eu-central-001
BackBlaze::EU_CENTRAL_002;   // eu-central-002
BackBlaze::EU_CENTRAL_003;   // eu-central-003
BackBlaze::EU_CENTRAL_004;   // eu-central-004
```

Usage
-----

[](#usage)

```
use Cesurapp\StorageBundle\Storage\Storage;

class FileController
{
    public function upload(Storage $storage): void
    {
        // Upload file (uses default device)
        $storage->upload('/tmp/photo.jpg', 'users/123/photo.jpg');

        // Write content directly
        $storage->write('Hello World', 'documents/hello.txt', 'text/plain');

        // Check if file exists
        if ($storage->exists('users/123/photo.jpg')) {
            // Get file URL
            $url = $storage->getUrl('users/123/photo.jpg');

            // Get file size
            $size = $storage->getSize('users/123/photo.jpg');

            // Get MIME type
            $mime = $storage->getMimeType('users/123/photo.jpg');
        }

        // Download file content
        $content = $storage->download('users/123/photo.jpg');

        // Download as resource
        $resource = $storage->downloadResource('users/123/photo.jpg');

        // Download as chunks (cloud only)
        foreach ($storage->downloadChunk('large-file.zip') as $chunk) {
            echo $chunk;
        }

        // Delete file
        $storage->delete('users/123/photo.jpg');
    }
}
```

### Using Specific Storage Device

[](#using-specific-storage-device)

```
// Use a specific storage device instead of default
$storage->device('local')->upload('/tmp/file.pdf', 'documents/file.pdf');
$storage->device('backblaze')->upload('/tmp/backup.zip', 'backups/backup.zip');
```

### Upload with Metadata (Cloud Only)

[](#upload-with-metadata-cloud-only)

```
$storage->upload('/tmp/photo.jpg', 'users/123/photo.jpg', [
    'ContentType' => 'image/jpeg',
    'CacheControl' => 'max-age=3600',
    'Metadata' => [
        'user-id' => '123',
        'uploaded-by' => 'admin'
    ]
]);
```

### Pre-signed URLs (Cloud Only)

[](#pre-signed-urls-cloud-only)

```
// Generate temporary access URL (expires in 1 hour)
$client = $storage->device('main')->getClient();
$presignedUrl = $client->getPresignedUrl(
    'bucket-name',
    'path/to/file.jpg',
    new \DateTimeImmutable('+1 hour')
);
```

### Local Driver Specific Methods

[](#local-driver-specific-methods)

```
$localDriver = $storage->device('local');

// Get file hash (MD5)
$hash = $localDriver->getFileHash('documents/file.pdf');

// Get directory size
$size = $localDriver->getDirectorySize('users/123/');

// Get partition free space
$freeSpace = $localDriver->getPartitionFreeSpace();

// Get partition total space
$totalSpace = $localDriver->getPartitionTotalSpace();

// Move file
$localDriver->move('/tmp/file.pdf', 'documents/moved-file.pdf');

// Delete directory
$localDriver->deletePath('temp/uploads/');
```

Testing
-------

[](#testing)

Tests for cloud providers require access credentials. Tests without credentials are automatically skipped.

### Configure Test Credentials

[](#configure-test-credentials)

Edit `phpunit.xml.dist`:

```

```

### Run Tests

[](#run-tests)

```
composer test
```

API Reference
-------------

[](#api-reference)

For detailed usage guidelines and best practices, see [GUIDELINES.md](GUIDELINES.md)

License
-------

[](#license)

MIT License - see [LICENSE](LICENSE) for details

###  Health Score

46

—

FairBetter than 93% of packages

Maintenance83

Actively maintained with recent releases

Popularity14

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity67

Established project with proven stability

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

Recently: every ~0 days

Total

12

Last Release

85d ago

PHP version history (3 changes)1.0.0PHP &gt;=8.2

1.1.0PHP &gt;=8.3

1.2.0PHP &gt;=8.4

### Community

Maintainers

![](https://www.gravatar.com/avatar/536cf2806f6fabc0e58a93484c57ee0ea9aba222f7ba9475a4d21a61cb1dbe96?d=identicon)[cesurapp](/maintainers/cesurapp)

---

Top Contributors

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

---

Tags

packagestorage-bundlesymfonysymfony-bundlesymfonystoragestorage-bundle

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

![Health badge](/badges/cesurapp-storage-bundle/health.svg)

```
[![Health](https://phpackages.com/badges/cesurapp-storage-bundle/health.svg)](https://phpackages.com/packages/cesurapp-storage-bundle)
```

###  Alternatives

[sulu/sulu

Core framework that implements the functionality of the Sulu content management system

1.3k1.3M152](/packages/sulu-sulu)[pentatrion/vite-bundle

Vite integration for your Symfony app

2755.3M13](/packages/pentatrion-vite-bundle)[scheb/2fa

Two-factor authentication for Symfony applications (please use scheb/2fa-bundle to install)

578630.7k1](/packages/scheb-2fa)

PHPackages © 2026

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