vortos/vortos-object-store
Composer 安装命令:
composer require vortos/vortos-object-store
包简介
Vortos object storage — S3-compatible storage with first-class Cloudflare R2 defaults
README 文档
README
S3-compatible object storage with Cloudflare R2 defaults, transactional outbox, direct-to-cloud uploads, and server-side multipart transfers.
Design
- User file uploads go directly to R2/S3 via presigned URLs. The backend issues a signed URL, stores the object key, and promotes from
tmp/to a permanent key after validation. - Mutations (put, delete, copy, move) are queued through the outbox so file adoption is atomic with domain DB changes.
tmp/keys are cleaned up by a bucket lifecycle rule managed viavortos:object-store:lifecycle.- Integration tests run against real R2/S3 credentials. LocalStack is not part of this package.
Configuration
use Vortos\ObjectStore\DependencyInjection\VortosObjectStoreConfig; return static function (VortosObjectStoreConfig $config): void { $config ->driver('s3') ->provider('r2') ->region('auto') ->bucket($_ENV['OBJECT_STORE_BUCKET']); $config->client() ->accountId($_ENV['OBJECT_STORE_ACCOUNT_ID']) ->credentials($_ENV['OBJECT_STORE_ACCESS_KEY_ID'], $_ENV['OBJECT_STORE_SECRET_ACCESS_KEY']); $config->bucketConfig() ->temporaryKeyPrefix('tmp') ->publicBaseUrl($_ENV['OBJECT_STORE_PUBLIC_BASE_URL'] ?? null) ->maxUploadSizeBytes(5_368_709_120) ->maxPresignTtlSeconds(3600); $config->lifecycle() ->enabled(true) ->requireConfirmation(true); };
Service Guarantees
The injected interface defines the delivery guarantee. There is no hidden config switch.
// Business workflows: outbox row is atomic with domain DB changes. // Use only inside CommandBus command handlers. DirectUploadManagerInterface $uploads; ObjectStoreInterface $objects; // Maintenance workflows: outbox reliability, but only the outbox row is transactional. StandaloneDirectUploadManagerInterface $uploads; StandaloneObjectStoreInterface $objects; // Diagnostics and probes: direct provider call, no outbox. ImmediateDirectUploadManagerInterface $uploads; ImmediateObjectStoreInterface $objects;
Direct Upload Flow
- Call
DirectUploadManagerInterface::createUploadIntent()for atmp/...key. - The client uploads directly to R2/S3 using the returned signed URL.
- Persist domain data with the temporary key.
- After validation, call
promote()— copies to a permanent key, optionally deletes the source.
Server-Side Multipart
ServerSideMultipartUploadManagerInterface handles backend-owned transfers: imports, exports, migrations, CLI jobs. It validates S3 part limits, keeps memory bounded by part size, retries transient part failures, and aborts failed uploads. Do not use it for browser uploads — use the direct-to-cloud flow above.
Lifecycle Provisioning
Lifecycle rules are never applied during HTTP requests, workers, or container boot.
php bin/console vortos:object-store:lifecycle show php bin/console vortos:object-store:lifecycle plan php bin/console vortos:object-store:lifecycle apply --confirm php bin/console vortos:object-store:lifecycle remove --confirm
The managed rule ID defaults to vortos-object-store-expire-temporary-uploads. The manager upserts only that rule, preserves unrelated rules, and writes the merged lifecycle config back through the S3 API.
Commands
php bin/console vortos:object-store:head <key> php bin/console vortos:object-store:presign <key> php bin/console vortos:object-store:presign <key> --upload --content-type=video/mp4 --max-size=209715200 php bin/console vortos:object-store:relay php bin/console vortos:object-store:lifecycle <show|plan|apply|remove> php bin/console vortos:object-store:multipart list --prefix=imports/ php bin/console vortos:object-store:multipart abort --key=imports/big.csv --upload-id=<id> --confirm php bin/console vortos:object-store:multipart abort-stale --older-than="-24 hours" --dry-run php bin/console vortos:worker:install --worker=object-store-outbox-relay
vortos/vortos-object-store 适用场景与选型建议
vortos/vortos-object-store 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 534 次下载、GitHub Stars 达 0, 最近一次更新时间为 2026 年 05 月 28 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 vortos/vortos-object-store 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 vortos/vortos-object-store 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 534
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 27
- 依赖项目数: 1
- 推荐数: 3
其他信息
- 授权协议: MIT
- 更新时间: 2026-05-28