Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/cesurapp/storage-bundle

Symfony Storage Bundle
https://github.com/cesurapp/storage-bundle

package storage-bundle symfony symfony-bundle

Last synced: 4 months ago
JSON representation

Symfony Storage Bundle

Awesome Lists containing this project

README

        

# 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://img.shields.io/badge/license-MIT-brightgreen.svg?logo=Unlicense)](LICENSE.md)

It is used for file storage. There is no database connection.
Async-aws/s3 package is used for S3 connection.
Tests are available for each driver, any test without access codes is skipped.
You can use multiple drives at the same time. Use MediaBunle to keep track of files.

### Supported Drivers

* BackBlaze
* CloudFlare
* Local

### Install
Required Symfony 7
```
composer req cesurapp/storage-bundle
```

### Configuration

```yaml
# config/packages/storage.yaml

storage:
default: main
devices:
local:
driver: local #backblaze, cloudflare, local
root: "%kernel.project_dir%/storage/files"

main:
driver: s3
root: /
accessKey: "access_key"
secretKey: "secret_key"
bucket: "bucket_name"
region: "auto"
endPoint: "https://11d0547262baad2e6bdeb340e88f83be.r2.cloudflarestorage.com"

backblaze:
driver: backblaze
root: /
accessKey: "access_key"
secretKey: "secret_key"
bucket: "bucket_name"
region: "auto"
```

### Tests

Tests for which access codes are not defined are skipped.

```xml

```

### Usage

```php
public function controllerAction(\Cesurapp\StorageBundle\Storage\Storage $storage) {
// Upload File
$storage->upload('source_path', 'upload_path');

// Write File
$storage->write('upload_path', 'text_content', 'application/text');

// Delete
$storage->delete('file_path');

// Check
$storage->exists('file_path');

// Read
$storage->read('file_path')
}
```