switon/storage

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

Maintainers

Package info

github.com/switon-php/storage

Documentation

pkg:composer/switon/storage

Statistics

Installs: 0

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

v1.0.0 2026-06-06 13:43 UTC

This package is auto-updated.

Last update: 2026-06-07 02:06:19 UTC


README

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.