Switon's blob storage layer with a filesystem-backed default implementation and a small contract for custom backends.
- 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.
composer require switon/storageuse 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
MIT.