athlon1600/php-curl-file-downloader
Download remote files in PHP using cURL with a simple, lightweight wrapper. Supports saving to disk, streaming, progress callbacks, custom headers/options, redirects and timeouts—handy for CLIs or apps that need reliable file downloads.
Architecture Fit
The package enhances Laravel/PHP applications handling dynamic filename generation from URLs, particularly for media streams (e.g., video playback). The improved filename guessing logic (v1.0.2) aligns with use cases where HTTP headers (e.g., Content-Type) can infer file extensions (e.g., .mp4). This is valuable for:
Integration Feasibility
Request or Response objects) to be accessible. Laravel’s built-in Illuminate\Http\Request or Symfony\Component\HttpFoundation\Request can provide these.Technical Risk
Content-Type values).Key Questions
Stack Fit
Request objects, service containers) with no external dependencies beyond PHP core.Migration Path
video/mp4, application/octet-stream)..webm).// Before (manual)
$filename = 'videoplayback.mp4';
// After (dynamic)
$filename = $package->guessFilenameFromUrl($url, $request->headers);
Compatibility
Sequencing
Maintenance
Support
tap() or middleware).Scaling
Failure Modes
video/mp4 for a corrupted file). Mitigate with content validation..php). Validate against a whitelist of allowed types.Ramp-Up
video/webm).How can I help you explore Laravel packages today?