async-aws/s3-vectors
Async AWS S3 Vectors client for PHP. Provides lightweight, non-blocking access to Amazon S3 vector features with request/response models, retries, and signing—ideal for apps that need fast, async integration without the full AWS SDK.
Guzzle) and middleware pipeline (e.g., auth, rate-limiting).S3VectorsClient to Laravel’s DI container:
$this->app->bind(S3VectorsClient::class, function ($app) {
return new S3VectorsClient([
'region' => env('AWS_REGION'),
'version' => 'latest',
]);
});
ShouldQueue interface for async operations:
class StoreVectorJob implements ShouldQueue {
use Dispatchable, InteractsWithQueue, Queueable;
public function handle() {
$client->putVector([...]);
}
}
float32[]) or structured formats (e.g., Parquet via spatie/array-to-parquet).| Risk Area | Mitigation Strategy |
|---|---|
| S3 Latency | Benchmark PUT/GET operations for vector sizes >1MB. Use S3 Select for partial queries. |
| No Native ANN Search | Implement client-side indexing (FAISS) or serverless search (OpenSearch DaemonSet). |
| Eventual Consistency | Add idempotency keys to jobs and retry logic (e.g., retry_after in Laravel). |
| Cost Overruns | Set S3 lifecycle policies (e.g., transition to Glacier after 90 days) and monitor with AWS Cost Explorer. |
| Unmaintained Package | Fork the repo or wrap in a Laravel package with extended docs/testing. |
| Vector Corruption | Validate vectors with checksums (e.g., md5) on retrieval. |
vector_id) sufficient, or is semantic search (ANN) required?async-aws/s3-vectors with Laravel’s queue:work (Redis, SQS, database). Example:
Queue::push(new StoreVectorJob($vectorData, $userId));
VectorStored, VectorRetrieved, or VectorSearch events for downstream processing (e.g., analytics, notifications).php artisan s3-vectors:import --file=embeddings.csv --batch=1000
storeVector) or REST endpoints with Laravel Sanctum/Passport for auth.$mock = Mockery::mock(S3VectorsClient::class);
$mock->shouldReceive('putVector')->andReturn(new PutVectorResult());
PutVector latency).async-aws/s3-vectors into a single Laravel service (e.g., App\Services\VectorService).class VectorService {
public function __construct(private S3VectorsClient $client) {}
public function store(array $vector, string $namespace, string $id) {
$this->client->putVector([
'Bucket' => config('s3-vectors.bucket'),
'Key' => "vectors/{$namespace}/{$id}.bin",
'Vector' => $vector,
]);
}
}
retry_after in Laravel) and dead-letter queues (SQS DLQ).class StoreVectorJob implements ShouldQueue {
use Dispatchable, InteractsWithQueue, Queueable;
public function handle() {
$this->vectorService->store($this->vector, $this->namespace, $this->id);
}
public function failed(\Throwable $exception) {
// Log to Sentry/Datadog
}
}
vectors/{user_id}).if (!$vector = cache()->get("vector:{$id}")) {
$vector = $this->client->getVector([...]);
cache()->put("vector:{$id}", $vector, now()->addMinutes(5));
}
async-aws/s3-vectors to ^1.0 and update composer.json:
"require": {
"php": "^8.0",
"async-aws/s3-vectors": "^1.0"
}
aws/aws-sdk-php v3.200+. Install via:
composer require aws/aws-sdk-php ^3.200
php-faiss) or use Python subprocesses.How can I help you explore Laravel packages today?