amarkhai/parallel-downloader-bundle
illuminate/support) allows for partial adoption. The core logic (concurrent downloads) is framework-agnostic and can be extracted if needed.DownloadManager would need adaptation (e.g., via a facade or custom binding).config/services.php or a custom config file.var/downloads; Laravel apps typically use storage/app/ or cloud storage (e.g., S3). Customization required.symfony/http-client for Guzzle).| Risk Area | Severity | Mitigation Strategy |
|---|---|---|
| Container Integration | High | Abstract DownloadManager behind a Laravel service or facade. |
| File System Assumptions | Medium | Override download_files_folder to use Laravel’s storage system. |
| Error Handling | Medium | Extend retry logic to log failures via Laravel’s Log facade. |
| Concurrency Limits | Low | Configure download_concurrency based on server resources. |
| Testing | Medium | Mock Guzzle HTTP client and file system for unit tests. |
storage/app/downloads) or cloud (S3)? Bundle needs adaptation for the latter.download:batch job) for better scalability?Http client + pestphp/parallel or custom GuzzleHandlerStack for more control.Filesystem or cloud adapters.Monolog integration to track download failures.Downloaded events for post-processing (e.g., image optimization).composer require amarkhai/parallel-downloader-bundle).DownloadManager:
// app/Providers/ParallelDownloaderServiceProvider.php
public function register()
{
$this->app->bind(DownloadManager::class, function ($app) {
return new DownloadManager(
$app->make(GuzzleClient::class),
$app->make('config')->get('parallel_downloader')
);
});
}
config/services.php:
'parallel_downloader' => [
'download_files_folder' => storage_path('app/downloads'),
'download_retry' => 3,
'download_concurrency' => env('DOWNLOAD_CONCURRENCY', 10),
],
Filesystem:
// Extend DownloadManager or use a decorator
$filesystem = $app->make('filesystem');
$downloadManager->setFilesystem($filesystem);
download() method as a job:
DownloadJob::dispatch($urls)->onQueue('downloads');
download_concurrency based on server resources (e.g., 5–20 for most VPS).| Component | Compatibility | Notes |
|---|---|---|
| Laravel 10+ | High | Symfony 6.0 components are supported. |
| Guzzle 7.4+ | High | Laravel’s default. |
| PHP 8.0+ | High | Required by bundle. |
| Local Storage | Medium | Needs adaptation for S3/cloud. |
| Queues | Low | Not natively supported; requires custom job. |
DownloadManager with mocked Guzzle.httpbin.org).storage:link or cron jobs).var/downloads (or equivalent) for disk usage.storage/app/downloads is writable.download_concurrency or add delays.Log facade to trace failures.spatie/async or custom GuzzleHandlerStack for more control.download_concurrency (test with ab or k6).memory_get_usage()).| Failure Scenario | Impact | Mitigation |
|---|---|---|
| HTTP Failures | Partial downloads | Retry logic + event notifications. |
| Disk Full | Downloads fail silently | Monitor disk space + cleanup. |
| High Concurrency Crash | Server OOM | Start with low concurrency. |
| Network Latency | Timeouts | Increase Guzzle timeout settings. |
| Symfony/Laravel Version Mismatch | Bundle breaks | Pin Symfony components in composer.json. |
How can I help you explore Laravel packages today?