Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message
Fetch Bundle

Fetch Bundle Laravel Package

abimus/fetch-bundle

Laravel package for fetching and bundling remote assets (CSS/JS/images) into a single, cacheable build. Helps reduce HTTP requests, manage dependencies, and serve optimized files in production with simple configuration.

View on GitHub
Deep Wiki
Context7

Symfony bundle for fetching mails from IMAP

Frequently asked questions about Fetch Bundle
How do I install abimus/fetch-bundle in a Laravel project?
Run `composer require abimus/fetch-bundle` in your project directory. The package is designed for Laravel via Symfony Bridge, so ensure you have `symfony/flex` installed. Follow the README’s configuration steps to define your asset bundles in `config/fetch.php` or `.env`.
Which Laravel versions does abimus/fetch-bundle support?
The package targets Laravel 8.x and 9.x via Symfony 5.4+ compatibility. Check the package’s `composer.json` for exact Symfony version constraints, as Laravel’s Symfony Bridge must align. For Laravel 10, verify compatibility with the latest Symfony LTS release.
Can I use this package to bundle assets from private APIs or authenticated endpoints?
Yes, the bundle supports authenticated fetches. Configure credentials (e.g., API keys, OAuth tokens) in your bundle definition or environment variables. For dynamic auth, use the `beforeFetch` event to inject headers or tokens per request.
How does caching work, and can I invalidate bundles manually?
Assets are cached locally by default with configurable TTL (time-to-live) in the bundle config. To invalidate, delete the cached files in `storage/fetch-bundle` or use the `abimus:fetch:clear` Artisan command. For production, set a long TTL and use versioned filenames to force updates.
Does abimus/fetch-bundle support incremental updates (fetch only changed files)?
Yes, use the `onlyIfModified` option in your bundle config to skip unchanged files. The package checks ETags or Last-Modified headers by default. For custom logic, override the `shouldFetch` method in your bundle class.
How do I integrate this with Laravel Mix/Vite for frontend asset pipelines?
Treat bundled assets as static files: reference them in your `mix.js`/`vite.config.js` via public paths (e.g., `/bundles/app.css`). Use the `publicPath` config to ensure consistency. Avoid duplicate processing—this bundle is for remote assets, not local builds.
Are there performance concerns with large bundles (e.g., 100+ files)?
Performance depends on network latency and server resources. For large bundles, enable parallel fetching with `maxConcurrentRequests` in config. Monitor queue jobs (if using async) and consider splitting bundles into smaller groups. Test with `abimus:fetch:test` to simulate production loads.
Can I use this package in a Laravel queue job for async fetching?
Yes, wrap the bundle’s `fetch()` method in a queueable job (e.g., `FetchBundleJob`). Use Laravel’s `dispatch()` to trigger async updates. For Symfony apps, integrate with Messenger. Ensure your queue worker has sufficient memory for large fetches.
What alternatives exist for bundling remote assets in Laravel?
For simple cases, use Laravel’s `file_get_contents()` with caching. For advanced needs, consider Laravel Mix’s `copy()` or Vite’s `optimizeDeps` for local assets. For remote JS/CSS, tools like Webpack’s `url-loader` or custom NPM scripts may fit. This bundle stands out for its Laravel/Symfony integration and IMAP-like reliability for dynamic assets.
How do I handle failed fetches or rate-limited endpoints?
Configure retry logic in the bundle’s `onFetchFailure` event listener. Use exponential backoff for rate limits by implementing a custom `RetryStrategy`. For production, log failures to Laravel’s log channel and set up monitoring (e.g., Sentry) to alert on repeated errors.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
socialdept/tenant-domains
tautvydasr/blade-class-names
socialdept/color-scales
maherelgamil/controller
coleus/widgets
coleus/table
coleus/users
coleus/music
coleus/health
coleus/calendar
coleus/notes
coleus/support
coleus/settings
coleus/apps
seampact/laravel
emmyconceptng/laravel-ng-postcode
jjsquady/round-robin
skyraptor/chatter
edlugz/sasapay
abbasudo/artisan-route