vineyard/s3-vectors-laravel
Composer 安装命令:
composer require vineyard/s3-vectors-laravel
包简介
Laravel integration for AWS S3 Vectors with smart caching and batching.
README 文档
README
Laravel integration for AWS S3 Vectors: query/get/put/delete with smart caching (Redis tags or versioned keys) and batch helpers.
Install
composer require vineyard/s3-vectors-laravel
php artisan vendor:publish --tag=config --provider="Vineyard\\S3Vectors\\S3VectorsServiceProvider
Set .env
AWS_ACCESS_KEY_ID=...
AWS_SECRET_ACCESS_KEY=...
AWS_DEFAULT_REGION=us-east-2
S3V_REGION=us-east-2
S3V_BUCKET=your-vectors
S3V_INDEX=your-vectors-index
Optional
CACHE_STORE=redis
S3V_TTL_QUERY=300
S3V_TTL_GET=600
S3V_HASH_PRECISION=4
S3V_DEFAULT_TOPK=5
Usage
use Vineyard\S3Vectors\Facades\S3Vectors; // Query (cached) $hits = S3Vectors::query($vector, topK: 5); // returns ['vectors' => [['key' => '...', 'distance' => 0.12, 'metadata' => [...]], ...]] // Get metadata by keys (cached) $info = S3Vectors::getVectors(['vectors/key1', 'vectors/key2']); // Put many vectors (invalidates cache for this index) S3Vectors::putVectors([ ['key' => 'vectors/key1', 'data' => ['float32' => $v1], 'metadata' => ['doc_id' => '123']], ['key' => 'vectors/key2', 'data' => ['float32' => $v2]], ]); // Batched put (chunks to 500 by default) S3Vectors::putVectorsBatched($bigArrayOfVectors, 500); // Delete S3Vectors::deleteVectors(['vectors/key1', 'vectors/key2']); // Batched delete (chunks to 500 by default) S3Vectors::deleteVectorsBatched($bigArrayOfVectors, 500);
Caching details
If the cache store supports tags (e.g., Redis), the package uses Cache::tags(["s3vectors:index:{bucket}:{index}"]) and flush() after writes.
Otherwise, it prefixes keys with a persistent version (e.g., v12345:) and bumps that version on writes to invalidate.
Notes
Your vector bucket and index must already exist in AWS S3 Vectors, and the IAM principal must have s3vectors:QueryVectors, s3vectors:GetVectors, s3vectors:PutVectors, s3vectors:DeleteVectors as needed.
Datatype (float32 vs float64) and vector dimension must match the index configuration.
For heavy loads, prefer putVectorsBatched() and add retry/backoff.
License
MIT
vineyard/s3-vectors-laravel 适用场景与选型建议
vineyard/s3-vectors-laravel 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 218 次下载、GitHub Stars 达 0, 最近一次更新时间为 2025 年 08 月 13 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 vineyard/s3-vectors-laravel 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 vineyard/s3-vectors-laravel 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 218
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 18
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-08-13