billhance/remote-assets-bundle
asset() helper and mix/vite already handle local assets—this package is not a replacement but a niche supplement.spatie/laravel-remote-storage) offers more granular control.symfony/console) as a dependency, which Laravel does not natively include. Workarounds:
public/ directory. Laravel’s storage system (e.g., storage/app/public) may require additional configuration.Guzzle or HTTP clients could add robustness.public/ path assumes default Laravel structure.mix/vite or spatie/laravel-remote-storage handle this use case?symfony/console acceptable for this niche use case?Filesystem or HTTP clients) achieve the same with less bloat?league/flysystem-aws, spatie/laravel-remote) with better Laravel integration?Illuminate\Support\Facades\File for filesystem ops.Illuminate\Support\Facades\Http or Guzzle for remote fetches.Console may conflict with Laravel’s versions of symfony/console or symfony/finder.// app/Console/Commands/CopyRemoteAsset.php
use Symfony\Component\Console\Application;
use Billhance\RemoteAssetsBundle\Command\CopyRemoteAssetCommand;
class CopyRemoteAsset extends Command {
protected $signature = 'assets:copy-remote {url} {destination}';
public function handle() {
$app = new Application();
$app->add(new CopyRemoteAssetCommand());
$app->run();
}
}
// app/Console/Commands/CopyRemoteAssetLaravel.php
use Illuminate\Support\Facades\Http;
use Illuminate\Support\Facades\File;
class CopyRemoteAssetLaravel extends Command {
protected $signature = 'assets:copy {url} {path}';
public function handle() {
$response = Http::get($this->argument('url'));
File::put(public_path($this->argument('path')), $response->body());
}
}
allow_url_fopen or cURL for remote fetches.public/ structure. Custom storage paths (e.g., storage/app/public) need manual configuration.symfony/console may pull in unnecessary dependencies (e.g., symfony/finder).Log facade.bus:work) for async downloads.public/ directory. Implement:
storage/framework/cache/remote-assets).| Failure Scenario | Impact | Mitigation |
|---|---|---|
| Remote URL invalid/malicious | CLI hangs or corrupt files | Validate URLs (regex, HTTPS-only). |
| Filesystem write permissions | Silent failures | Use Laravel’s File::ensureDirectoryExists(). |
| Network timeouts | Partial/corrupt files | Add retry logic with Http::timeout(). |
| Symfony dependency conflicts | Broken CLI commands | Isolate in a separate Composer package. |
| Package abandonment | No future updates | Fork or rewrite as Laravel-native. |
php artisan assets:copy).--help output).How can I help you explore Laravel packages today?