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

Js Compress Laravel Package

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.

View on GitHub
Deep Wiki
Context7

Product Decisions This Supports

  • Build vs. buy for asset minification: This is a "buy" (adopt an existing library) answer to a very narrow question — "can we minify JavaScript from PHP at runtime or build time without a Node toolchain?" It is a decision-support input, not a feature in itself; it does not ship user-visible functionality.
  • Server-side/on-the-fly asset optimization: The realistic use case is minifying or re-compressing JS from PHP — for example a plugin/theme system that lets customers upload JS, a CMS that serves stored snippets, or a legacy PHP-only deploy target where adding Node to CI is undesirable.
  • Pipeline plumbing in a PSR-7/asset-middleware stack: It fits as a compressor implementation within the wyrihaximus/compress family rather than as a standalone Laravel-native tool. If your architecture already uses that middleware approach, this is a cheap slot-in; if not, it is an orphan dependency.
  • Roadmap signal (negative): 4 stars, 0 dependents, and a single-maintainer profile mean this should not be a load-bearing dependency in a product roadmap. It is a convenience library, not a platform bet.
  • Explicit non-decision: It should not displace Vite/Mix in a greenfield Laravel app. Modern Laravel minifies JS at build time with esbuild/terser; adopting this adds a second, weaker optimization path and a dependency your team must own.

When to Consider This Package

Consider it when most of the following hold:

  • You are minifying JS from PHP, at request or build time, and adding Node/npm to the pipeline is genuinely blocked (locked-down hosting, shared hosting, a PHP-only container image, air-gapped or plugin sandboxes).
  • You already use the wyrihaximus/compress middleware ecosystem, so the contracts and integration cost are near zero.
  • The JS being compressed is small, self-contained, and not something you can pre-build — customer-provided snippets, admin-editable code, per-tenant bundles.
  • You accept the maintenance risk: you are willing to pin a version, read the source (it is small and MIT-licensed), and vendor or fork it if needed.
  • Your quality bar tolerates a PHP-side minifier. Expect meaningfully weaker output than esbuild/terser (worse mangling, dead-code elimination, and source-map support), so measure the size delta before committing.

Look elsewhere when:

  • You are building a standard Laravel app: use Vite (Laravel's default) or Mix. Minification belongs in the build step, not in PHP.
  • You need source maps, ES-module-aware transforms, tree shaking, or modern-syntax handling — this package will not deliver those.
  • You need organizational confidence: 4 stars, 0 dependents, and a single maintainer is a bus-factor-of-one dependency. For anything customer-facing or long-lived, prefer tedivm/jshrink (more widely used, similar scope), a Node-based step (esbuild, terser) invoked from a Laravel command, or a CDN/edge optimizer.
  • Your JS volume is large or latency-sensitive: shelling out or minifying per request will hurt p95 latency. Cache aggressively or precompute.
  • You require active security response: with a community this small, treat vulnerability triage as your own responsibility.

How to Pitch It (Stakeholders)

For executives (one line): A small, MIT-licensed PHP utility that shrinks JavaScript without a Node build step — useful only in the narrow case where our stack cannot run Node; not a fit for our standard Laravel front end, where Vite already handles this.

For engineering: It is a compressor implementation for the wyrihaximus/compress asset middleware, letting PHP minify JS inline. It removes a Node dependency from the deployment, at the cost of lower compression quality, no source maps, and a single-maintainer project with effectively no adoption (4 stars, 0 dependents). Recommendation: do not adopt for the main app — keep Vite. Revisit only if we hit a concrete PHP-only constraint (e.g., a plugin sandbox that must compress tenant-supplied JS server-side); in that case, prototype it against tedivm/jshrink and a Node-based alternative, and compare output size, latency, and maintenance burden before choosing. If we do adopt, pin the version, wrap it behind our own interface so it is swappable, and precompute compressed assets rather than minifying on every request.

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.
htinlynn/genius-helper
maco-studios/hephaestus
elmogy/larafast
xeviant/laravel-paystack
gorilladash/laravel-website-sdk
martialbe/flysystem-oss
chondal/3312client
jeroen-g/flickr
opscale-co/nova-genbi
itsjustvita/laravel-retention
tequilarapido/trackit
gregsphotography/site-builder-filament
cabaoctavio/laravel-query-log
gregsphotography/site-builder-components
io-digital/clickatell
snowsoft/laravel-admin
oxygen/auth
relicsoftware/barakah-payment-gateway
tobya/work-with-composer
equipc/laravel-email-validator