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

Minifier Bundle Laravel Package

sema/minifier-bundle

Sema Minifier Bundle integrates configurable HTML, CSS, and JavaScript minification into Symfony applications. It compresses responses and assets on the fly, supports caching and filters, and helps reduce page weight, load times, and bandwidth with minimal changes to existing templates.

View on GitHub
Deep Wiki
Context7

This Symfony2 bundle allows you to minify html code, combine and minify JavaScript files and CSS files without Java VM.

Frequently asked questions about Minifier Bundle
Can I use sema/minifier-bundle in a Laravel application?
Not directly. Despite being catalogued alongside Laravel packages, sema/minifier-bundle is a Symfony 2.x bundle whose entire integration surface is the Symfony DI container: a Bundle class, a DependencyInjection extension that parses a config tree, and compiler passes that register minifier services and wire them into the templating and asset layers. Laravel has no bundle concept, and Laravel's service providers, config semantics, tagged services and compiler-pass timing do not map onto Symfony's. Any Laravel adoption is therefore a port, not a composer require.
How do I install sema/minifier-bundle with Composer?
The package name is sema/minifier-bundle, and in a Symfony app you would register the bundle in AppKernel after requiring it. Expect PHP and symfony/* version constraints from the Symfony 2 era that may conflict with the Symfony 6/7 component pins in a current Laravel install, so Composer resolution can fail outright before any code runs. If you only want to evaluate the minification logic, install it in a throwaway project with --dev rather than in your application.
Does sema/minifier-bundle support Laravel 10 or 11 and modern PHP?
There is no Laravel support at all, official or otherwise, because the package targets Symfony 2.x. Its declared PHP and symfony/* constraints are old enough that installation alongside modern Laravel is unlikely without dependency conflicts. Check the composer.json constraints and the last commit date before assuming it will install on a current PHP runtime.
Does sema/minifier-bundle require Java to minify JavaScript and CSS?
No. The bundle's stated selling point is that it minifies HTML, JavaScript and CSS in pure PHP without a Java VM, which mattered in the Assetic plus YUI Compressor era when CI images needed a JRE. That removes a deployment dependency, but it does not make the minifier equivalent to a mature Node-based tool. Pure-PHP JS minification carries real risk of silently changing semantics if the tokenizer is naive.
How does sema/minifier-bundle minify HTML responses?
It compresses responses on the fly, supporting caching and configurable filters, so minification is applied to rendered output rather than to source templates. The exact behaviour is driven by the bundle's config tree, including per-environment rules and exclusion lists. Read the DependencyInjection extension and any compiler passes to see exactly which services are registered and when they run.
Is sema/minifier-bundle abandoned or safe for production?
The signals are poor: a 5-star, zero-dependent, Symfony 2.x-era artifact is a strong indicator of an unmaintained package. Check the Packagist abandoned flag, the last commit date and the open-issue count before considering it. The bigger production concern is failure mode: broken minification usually produces subtly wrong output instead of throwing an exception, which is the worst class of bug for an asset pipeline.
What is the Laravel equivalent of sema/minifier-bundle?
For CSS and JavaScript the modern equivalent is build-time minification through Vite, which has been Laravel's default since 10.x and uses battle-tested tooling. HTML response minification is the only genuinely uncovered niche, and in Laravel that is roughly a 100-line middleware rather than a package. If you need a PHP minifier for CSS and JS, an actively maintained library such as matthiasmullie/minify is a safer choice than this bundle.
How do I minify HTML responses in Laravel without this bundle?
Write a middleware that intercepts the response, skips anything that is not HTML, and skips streamed, JSON and file responses. Collapse whitespace conservatively, leave the bodies of pre, textarea, script and style elements untouched, and preserve conditional comments. Cache the result per route and add tests for idempotency so already-minified input passes through unchanged.
Can I extract the minifier classes from the bundle and use them standalone in Laravel?
Only if the core minifier classes are free of Symfony type hints. Inspect the service constructors first, because some bundles hard-wire Symfony component types, which turns an adapter job into a rewrite. If the classes are cleanly separable and the MIT licence permits it, copy them into app/Support/Minify, strip any framework coupling, and wrap them in a service provider or response middleware.
Is the minified output from sema/minifier-bundle safe around pre, textarea and inline scripts?
HTML minification implemented with regex and string manipulation is notoriously fragile around pre, textarea, script and style bodies, conditional comments, and whitespace-sensitive inline elements. Pure-PHP JavaScript minification is riskier still, since a naive tokenizer can silently change program semantics. Verify whether a test suite exists and whether it covers these edge cases, source map preservation, and idempotent handling of already-minified input.
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.
middlewares/firewall
qubiqx/montapacking
nyoncode/laravel-package-console
pnscripts/filament-broadquill-lite
pnscripts/laravel-sentfold-lite
vleap/mx-sdk-laravel-internal
twidpay/utils
htetmyathlaing/scout-elasticsearch-driver
artisan-toolbox/front-awesome
ls/client-assistant
users-au/laravel-client
cgv/localized-resource
noith/settings
kda/laravel-package
kda/filament-dynamic-navigation
bypersoft/signbox
pairus/product-data
fayne/laravel-filament-cms-core
nodisrupt/laravel-agent
sierratecnologia/media-manager