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

Uglify Laravel Package

nodejs-php-fallback/uglify

A PHP fallback for UglifyJS that minifies JavaScript without needing Node.js installed. Keeps asset pipelines simple in Laravel and PHP projects by providing a native minifier when Node is unavailable.

View on GitHub
Deep Wiki
Context7

Technical Evaluation

Verdict up front: do not adopt for a new Laravel codebase. The package solves a problem that the modern Laravel toolchain has already eliminated, and it carries unmanaged technical debt (unmaintained since January 2019, 17 stars, 0 dependents). Its only defensible use case is a narrow, legacy one described below.

Architecture fit

  • The package's premise is "minify JS/CSS by shelling out to uglify-js/clean-css via Node, and fall back to pure-PHP minifiers when Node is absent." That is a build-time concern, not an application-runtime concern.
  • Laravel's supported answer to this is Vite (Laravel 9.19+) or the legacy Laravel Mix. Both require Node at build time and both bundle mature, actively maintained minifiers. Introducing a second, parallel minification path creates two sources of truth for asset output.
  • The fallback design is the real architectural smell: identical source can produce different bytes depending on whether Node happened to be on the machine. That is nondeterministic build output, which is a release-integrity problem, not a convenience feature.

Integration feasibility

  • Composer-installable, MIT-licensed, no framework coupling — so it would technically drop into a Laravel service provider without friction.
  • Practical fit is poor: the code predates PHP 8. Implicit-nullable parameter deprecations (8.1) and dynamic-property deprecations (8.2) are highly likely to fire; a PHP 8.3/8.4 runtime is a real compatibility question mark.
  • uglify-js itself is effectively superseded by terser and, critically, cannot parse ES2015+ syntax without a transpile step. Any modern front-end source passed through this wrapper will either fail or require a Babel pre-pass — negating the simplicity it advertises.
  • Dependency chain is unmanaged: whether it invokes a global node binary or fetches npm packages at runtime materially changes the security and reproducibility profile. This must be verified before any further consideration.

Technical risk (high)

  • Abandonment risk: seven-year-old last release, single maintainer, zero dependents. No security response path, no CVE triage, no PHP-version support policy.
  • Silent degradation risk: if the PHP fallback path engages, output is produced by a materially weaker minifier. Failures manifest as slightly larger bundles, not errors — invisible until someone audits.
  • Supply-chain risk: an npm/Node invocation from PHP is an execution surface that Composer's audit tooling does not cover.
  • Reputational/lock-in risk: low. It is a thin, replaceable wrapper — easy to remove, which is also why it is low value.

Key questions to answer before any spike

  1. Does it invoke a global node binary, npx, or bundle npm packages? What exactly executes at install and at runtime?
  2. Does the PHP fallback produce functionally equivalent output, or only "smaller than nothing"?
  3. Is there any PHP 8.1+ compatibility? Are there open issues or forks addressing it?
  4. What is the actual trigger condition for fallback (Node missing, non-zero exit, timeout)?
  5. Is there a maintained fork or is this a dead end?

Integration Approach

Stack fit: poor. Laravel's asset pipeline is Node-based by design. A PHP-side minifier is a workaround for environments that cannot run Node — shared hosting without build steps, or deploy targets where the build artifact is produced elsewhere.

Recommended sequencing (if pursued at all)

  1. Confirm the constraint is real. If the team can run npm ci && npm run build, stop here. Adopting this package would add risk for zero benefit.
  2. Timebox a one-day spike in a throwaway branch, not main. Verify PHP 8.x behavior, inspect the actual Node invocation, and confirm ES6 handling against a representative real-world bundle.
  3. Wrap behind an interface. If adopted, define an internal AssetMinifier contract and bind this package as one implementation. Never let application code call the package directly — that preserves the exit path.
  4. Pin absolutely. Exact Composer version, lockfile committed, and a documented note recording the last-release date and the absence of upstream maintenance.
  5. Add a CI assertion that minified output is byte-identical across two clean environments. If it isn't, the fallback path is firing silently — treat as a build failure.

Preferred alternatives by scenario

  • Standard Laravel app: Vite (laravel-vite-plugin) — no wrapper needed.
  • Legacy Mix app: stay on Mix until a Vite migration is scoped; do not layer a second minifier on top.
  • Node genuinely unavailable at runtime and assets must be minified on the fly: prefer matthiasmullie/minify directly (more usage, wider awareness) or pre-minify at build time in CI and ship the output. Runtime minification is almost always the wrong shape.
  • Symfony-shop equivalent: AssetMapper.

Compatibility note: the migration path away from this package is trivial (it is a leaf dependency), so the real cost is not lock-in — it is the maintenance burden of carrying an unpatched component in your composer.json for as long as it stays.

Operational Impact

Maintenance: effectively zero upstream. Every future PHP minor release is an unowned compatibility bet on your side. Budget for eventual fork-and-patch or removal; treat the package as a temporary shim with a dated exit criterion, not a component.

Support: no vendor, no active issue triage, no Slack/Discourse presence. Internal engineers will be the sole support tier for a wrapper they did not write. A single-maintainer, seven-year-dormant project means an outage or PHP upgrade break is resolved by you, on your timeline.

Scaling: build-time minification scales trivially; this package's fallback path is CPU-bound PHP string manipulation, noticeably slower than native minifiers on large bundles. If it runs per-request (rather than per-deploy), that cost lands directly on request latency and is a real capacity concern. Confirm whether output is cached — if not, it must be.

Failure modes to instrument

Mode Symptom Detection
Node absent → silent fallback Larger/misformatted bundles Determinism check in CI
uglify-js ES6 parse error Non-zero exit, fallback engages Exit-code logging
PHP 8 deprecation Log noise; eventual fatal Static analysis, deprecation logs
Partial write on minifier crash Empty/truncated asset served Asset size sentinel; health check
Version drift of npm dependency Output changes between deploys Hash the artifact, not the source

Ramp-up: low — the API surface is small and the concept is immediately graspable. That is also why adopting it saves almost nothing: the wrapper is thin enough that writing a 40-line internal minifier shell-out (with a chosen, pinned Node tool) would give you the same behavior with ownership and a current dependency set.

Bottom line for the roadmap: score of 0.115 with an opportunity score of 20.83 is directionally correct — this is a dated solution to a solved problem. Recommend recording it as evaluated and declined unless a specific hosting constraint proves Node unavailability, in which case the honest move is a small in-house wrapper over a maintained minifier rather than taking on an unmaintained 2019 dependency.

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.
uni-method/symfony-lib
tacticmedia/scim-server-bundle
neika-ai/symfony-bundle
mattleads/agent-publishing-bundle
glavweb/framework-bundle
glavweb/extra-bundle
glavweb/api-bundle
glavweb/admin-bundle
adachsoft/api-version-bundle
elsayed85/laravel-api-exceptions
ouhssini/laravel-demo-mode
daworks/ncloud-outbound-mailer-driver
gp247/cms
ignibyte/aic-gates
nexa-merchant/blog
novasa/laravel-language-center
opencage/geocode
adolfoholzer/parameters
livenetworks/ln-starter
shitoudev/permissionmanager