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
Minify Bundle

Minify Bundle Laravel Package

sensiolabs/minify-bundle

SensioLabs Minify Bundle integrates the Minify tool into Symfony Asset Mapper to automatically minify CSS and JS during the build process. It stores minified assets in Symfony's cache, downloads the binary from GitHub, and can reduce asset sizes by up to 70%.

View on GitHub
Deep Wiki
Context7

Assets Minifier (CSS, JS) for Symfony & Minify integration in Asset Mapper

Frequently asked questions about Minify Bundle
Does SensioLabs Minify Bundle work with Laravel?
SensioLabs Minify Bundle is a Symfony bundle that integrates with Symfony Asset Mapper, not a native Laravel package. Using it in Laravel requires a custom integration layer, such as an AssetServiceProvider that wraps Symfony's UrnResolver and maps it to Laravel's asset() helper. It is most viable for hybrid Symfony-Laravel monoliths or Blade apps serving static assets, not SPAs where Vite or Webpack are better fits.
How do I install sensiolabs/minify-bundle?
Install it with Composer using composer require sensiolabs/minify-bundle. In a Symfony app, enable the bundle and let Asset Mapper run the minifier during the build. In Laravel, you must add your own service provider and UrnResolver adapter before the build pipeline can use it.
What PHP version does sensiolabs/minify-bundle require?
The README badges and composer metadata indicate PHP 8.2 or higher. The v1.3.1 release also adds OptionsInterface PHPDoc to avoid implicit nullable deprecation warnings, which helps teams preparing for PHP 8.4. You should still verify the exact constraint in composer.json for your chosen version.
How does the bundle minify CSS and JS during the Symfony Asset Mapper build?
It integrates the Minify tool into Symfony Asset Mapper so CSS and JS are minified automatically during the build process. The minifier removes whitespace, comments, and other unnecessary bytes, with documented gains up to 70% on large files. Minified output is stored in Symfony's cache for fast reuse.
Where are minified assets stored and how do I clear the cache?
Minified assets are stored in Symfony's cache. You should clear that cache whenever source assets change, especially in deployment scripts. In a Laravel integration, bind Symfony's HttpCache behavior to Laravel's cache interface and clear cache tags on asset updates to avoid serving stale minified files.
Does SensioLabs Minify Bundle download the Minify binary automatically?
Yes, the bundle automatically downloads the Minify binary from GitHub. That simplifies setup but introduces network and supply-chain considerations for locked-down CI or production builds. Allowlist the download host, pin versions where possible, and cache the binary in your build image if you need reproducible builds.
Is sensiolabs/minify-bundle maintained and safe for production use?
Version 1.3.1 is a maintenance patch with a PHPDoc-only change, indicating the package is being kept forward-compatible with PHP 8.4. However, the release notes for v1.3.0 were not reviewed in the technical assessment and should be retrieved before sign-off, because minor versions can include feature or signature changes. Adopters upgrading from v1.2.0 have low migration risk based on v1.3.1.
What are alternatives to SensioLabs Minify Bundle for Laravel asset minification?
For Laravel SPAs, Vite and Laravel Mix or Webpack are more natural choices and include minification in their production builds. For hybrid or Symfony-influenced monoliths, you can use Symfony Asset Mapper with this bundle or a different minifier. Choose based on whether you need Laravel-native tooling or Symfony Asset Mapper compatibility.
How can I test minification and compatibility in CI?
Run your asset build in CI and assert that cached CSS and JS outputs are smaller than the sources. Add PHPStan or static analysis to catch OptionsInterface nullable issues, and run a PHP 8.4 job to surface deprecation warnings. For Laravel integrations, include an integration test for your UrnResolver adapter and cache invalidation behavior.
What are the main risks of using this bundle in a Laravel application?
The biggest risks are Symfony 8 dependency conflicts, UrnResolver integration complexity, and cache invalidation between Symfony and Laravel. Strict typing and Blade-versus-Twig differences also add friction. Mitigate by aliasing Symfony packages, wrapping UrnResolver in a service provider, clearing cache on asset updates, and enabling strict_types where practical.
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.
robertmarney/lara-hierarchial-collections
simonschaufi/rule-doc-generator
emissaoja/emissaoja
blackbricksoftware/gravityforms-civicrm-form-processor
al-rahabi/fancy-crud
jinas/dhivatar-component
mltstephane/laravel-quality
bernskiold/laravel-talentlms
bernskioldmedia/laravel-form-architect
youbar/easy-crud
c-point-labs/laravel-hostyourai
dbravoan/dbcms-admin-theme-dbcms
dbravoan/dbcms-theme-db-cyber
dbravoan/dbcms-blocks-basic
dbravoan/dbcms-module-content-audit
dbravoan/dbcms-module-ai-assistant
paygate-to/paygate-php
padosoft/askmydocs-connector-base
defstudio/supercharged-carbon
bernskioldmedia/laravel-matomo