async-aws/core
Shared core library for AsyncAws services: common utilities, HTTP/stream handling, exceptions, and AWS request/response infrastructure. Includes an STS client for authentication and credentials. Install via composer require async-aws/core.
HttpClient with retry mechanisms, making it ideal for Laravel Queues, Horizon, or Livewire where async operations are critical.PsrCacheProvider or Symfony’s cache).composer require async-aws/core) and minimal boilerplate. Laravel’s Service Container can bind AwsClientFactory and service clients (e.g., S3Client) as singletons.~/.aws/config), environment variables, and Laravel’s config/aws.php. The ConfigurationProvider merges profiles across files, reducing manual setup.ResultMockFactory enables unit testing without AWS calls, valuable for Laravel’s testing stack (Pest, PHPUnit).symfony/http-client (v5.4+) and symfony/cache (v5.4+). Laravel already includes these, but version conflicts could arise if other packages enforce stricter versions.sync queues for immediate responses).AsyncAws\Core\Exception\*) must be mapped to Laravel’s exception handlers (e.g., App\Exceptions\Handler) to ensure consistent error responses.max_execution_time) be managed?ConfigurationProvider::merge().)AwsClientFactory with roleArn.)ResultMockFactory replace Laravel’s Mockery for AWS service tests?debug config option log AWS requests to Laravel Log or a dedicated system (e.g., Datadog)?AwsRetryStrategy need tuning (e.g., exponential backoff)?AppServiceProvider.config('aws') to override defaults (e.g., region, endpoint).PsrCacheProvider for credential caching (e.g., Redis).Log channel for AWS request/response debugging.sync queues for immediate responses (e.g., S3::putObject()).async-aws/core and async-aws/s3 (example).config/aws.php:
'default' => 's3',
'clients' => [
's3' => [
'region' => env('AWS_REGION', 'us-east-1'),
'version' => 'latest',
],
],
AppServiceProvider:
$this->app->singleton(S3Client::class, fn($app) =>
AwsClientFactory::create($app['config']['aws.clients.s3'])
);
StsClient for temporary credentials (e.g., cross-account access).$sts = $this->app->make(StsClient::class);
$credentials = $sts->assumeRole(['RoleArn' => 'arn:aws:iam::123:role/Example']);
ProcessS3Upload::dispatch($file, $bucket);
AwsRetryStrategy in jobs for resilience.ResultMockFactory:
$mock = ResultMockFactory::createFailing(
new PutObjectInput(),
new PutObjectResult(),
new ClientException('Test error', 400)
);
aws/aws-sdk-php (v3) with a modern, async-first approach.symfony/http-client versions.debug: true in config to log requests during ramp-up.async-aws/core for PHP 8.3+ compatibility (changelog 1.28.0 dropped PHP <8.2).%region% placeholders).AwsClientFactory to inject Laravel’s cache or config:
$factory = new AwsClientFactory(
new ConfigurationProvider($config),
new SymfonyCacheProvider($app['cache']),
new RetryableHttpClient($app['http.client'])
);
debug: true in config to log AWS requests/responses to Laravel Log.App\Exceptions\Handler to convert AsyncAws\Core\Exception\* to Laravel responses:
public function render($request, Throwable $exception) {
if ($exception instanceof ClientException) {
return response()->json(['error' => $exception->getAwsErrorMessage()], 400);
}
return parent::render($request, $exception);
}
PsrCacheProvider with Redis to avoid STS token refreshes.AwsRetryStrategy to avoid throttling:
$client = AwsClientFactory::create([
'retry_strategy' => new AwsRetryStrategy(3, 100, ['429' => true]),
]);
| Failure Scenario | Mitigation | Laravel Integration | |--------------------------------|----------------------------------------------------------------------------
How can I help you explore Laravel packages today?