Skip to content

switon-php/storage

Repository files navigation

Switon Storage Package

Storage CI PHP 8.3+

Switon's blob storage layer with a filesystem-backed default implementation and a small contract for custom backends.

Highlights

  • Small blob contract: custom backends stay easy to swap in.
  • Filesystem storage: objects can be stored under a root path with alias resolution.
  • Stream support: readable and writable streams are supported.
  • File upload path: files can be written from disk with extension restrictions.
  • Safe keys: object keys must stay relative.

Installation

composer require switon/storage

Quick Start

use Switon\Core\Attribute\Autowired;
use Switon\Storage\BlobStoreInterface;

class AvatarService
{
    #[Autowired] protected BlobStoreInterface $blobStore;

    public function save(int $userId, string $bytes): void
    {
        $this->blobStore->put("avatars/{$userId}.bin", $bytes);
    }
}

Docs: https://docs.switon.dev/latest/storage

License

MIT.

About

Local filesystem blob storage with safe relative keys under one root for Switon Framework

Topics

Resources

License

Security policy

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages