switon / storage
Local filesystem blob storage with safe relative keys under one root for Switon Framework
v1.0.0
2026-06-06 13:43 UTC
Requires
- php: >=8.3
- switon/core: ^1.0
Requires (Dev)
- phpstan/extension-installer: ^1.4
- phpstan/phpstan: ^2.0
- switon/testing: ^1.0
README
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.