wyrihaximus/js-compress
Compress and minify JavaScript in PHP with wyrihaximus/js-compress, a small library that wraps a JS compressor behind a simple API so you can shrink assets during your build or at runtime.
Architecture fit
Integration feasibility
composer require, instantiate a compressor, run a fixture set through it, diff output. A one-to-two-day evaluation is realistic and largely consists of validating output correctness, not wiring.public/build artifacts is overwritten on the next npm run build, so the package must sit downstream of the build output into a separate, versioned directory, or be confined to runtime-generated assets.Technical risk
this binding, regex literals). Pure-PHP minifiers historically lag on modern syntax and can produce broken output rather than an error.Key questions
Stack fit
matthiasmullie/minify (far higher adoption, actively maintained, pure PHP) and with the Vite/Terser pipeline (already in the stack, zero marginal cost). Any adoption decision must be justified against those two alternatives, and on current evidence matthiasmullie/minify wins on adoption and Vite wins on quality.Migration path
JsMinifier interface from day one.matthiasmullie/minify usage, the path is: introduce our interface, add a matthiasmullie adapter and this package's adapter, run both against the same fixture corpus, and diff outputs and timings before switching.Compatibility
Sequencing
matthiasmullie/minify and Terser.Maintenance
Support
composer.lock; treat the Node/Terser version as a separately pinned artifact in container images.Scaling
Failure modes
Ramp-up
Recommendation for the TPM
matthiasmullie/minify covers the pure-PHP case with far stronger adoption.How can I help you explore Laravel packages today?