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

Composer Patches Laravel Package

vaimo/composer-patches

Composer plugin that applies patches to installed dependencies during install and update. Define patches in composer.json using local or remote files, keeping vendor modifications reproducible across every environment and team member.

Deep Wiki
Context7

Technical Evaluation

Architecture fit. This is an install-time dependency-mutation tool. It lives in the Composer plugin layer and rewrites third-party code inside vendor/ during composer install / update. Fit is therefore a policy question before it is a technical one: does the org accept "patched vendor code" as a legitimate, governed deployment pattern? Strong fit for Magento 2 and other PHP platforms where upstream fix latency exceeds business tolerance; weak fit for teams that can fork, vendor, or wait for an upstream release. There is no runtime coupling, no service footprint, and no application code change required — it is confined to the build.

Integration feasibility. Low friction. A composer require plus patch declarations in root extra.patches or in the composer.json of internal packages. The package-level declaration is the differentiating capability: a platform team can ship a "blessed patch layer" inside its own shared packages and have consumers inherit it, rather than duplicating patch lists per repository.

Technical risk.

  • Composer 2.2+ allow-plugins gating: if not whitelisted, the plugin is silently ignored and patches vanish.
  • Patch state is not recorded in composer.lock; reproducibility depends on plugin version + patch files + application order.
  • Multi-package patches against the same file have implicit ordering; conflicts are the primary breakage source.
  • Remote patch URLs introduce install-time network dependency and a mutable, unchecksummed supply-chain surface.
  • Vendor mutation breaks IDE/static-analysis assumptions and is wiped by vendor cache restores or --no-plugins builds.
  • Concentration risk: single-vendor (Vaimo) project, ~300 stars, MIT, no commercial SLA.

Key questions.

  • Does a failed patch fail the build, and can that be enforced as policy?
  • Which composer-plugin-api versions are supported against our pinned Composer release?
  • Are patches reapplied on composer install from lock in CI, and how does that interact with vendor caching, --no-scripts, and --no-plugins?
  • Can patch sources be pinned to internal artifacts and remote URLs disallowed entirely?
  • Is there an auditable "list of applied patches" artifact usable as release evidence?
  • What is the divergence and migration cost versus cweagans/composer-patches?

Integration Approach

Stack fit. Any Composer-based PHP application, especially ones with a stable, pinned dependency set and a small, well-understood patch surface. Poor fit where vendor/ is treated as immutable or produced by a read-only artifact registry.

Migration path. From cweagans/composer-patches, semantics are close but not identical — expect a config rewrite (entry shape, path-strip level, ordering) and a full regression build. Do it in two steps: run both in a branch and diff the resulting vendor/ tree, then cut over in a single PR that removes the old plugin. Never run both concurrently.

Compatibility. Verify PHP constraint and plugin API against the pinned Composer. Ensure CI/Docker images carry git (preferred applier) and patch, and either allow egress or vendor all patch files locally. Confirm event-ordering against other Composer plugins in the stack (installers, mergers, Magento's own plugin chain). Developer-machine parity on Windows is historically fragile — standardize on git apply.

Sequencing.

  1. PoC: one non-critical package, one patch, throwaway branch.
  2. Conventions: patches in-repo under patches/, named <package>-<ticket>-<seq>.patch, each linked to an upstream issue.
  3. CI: clean-vendor build that asserts the expected applied-patch list.
  4. Roll out per package; retire manual "copy over vendor" hacks as you go.
  5. Guardrail job that fails when a patch no longer applies after a dependency bump.

Operational Impact

Maintenance. The plugin is not the cost centre; the patch backlog is. Every dependency bump is a potential patch break. Assign a platform/build owner, a monthly patch-rot review, and a hard rule that every patch has an upstream issue, an owner, and a review/expiry date. Patch files are source-of-truth artifacts and must go through code review.

Support. Community-supported with vendor interest; assume you may need to fork. Pin the version exactly, avoid floating constraints, and upgrade deliberately with the guardrail job as the gate. No SLA — plan accordingly.

Scaling. Cost scales linearly with patch count × dependency-update frequency, not with traffic or user volume. Organizational scaling is the real constraint: centralize patch definitions in an internal meta-package rather than replicating lists across repositories.

Failure modes.

  • Patch silently not applied (plugin blocked by allow-plugins, cached vendor) → a production bug that reads as an upstream regression. This is the dangerous one.
  • Patch fails after a bump → build break (acceptable) versus skipped-with-warning (unacceptable).
  • Two packages patching the same file → order-dependent or rejected application.
  • Remote URL drift/404 → build outage.
  • Dev/prod divergence from stale local vendor trees.
  • Security: plugin-mediated arbitrary code execution plus remote fetch — audit and lock down.

Ramp-up. A competent PHP developer is productive in a day. The larger lift is organizational: reviewers understanding why vendor code is mutated, and CI proving it every build. Publish the "one patch, one ticket, one owner" policy before enabling broadly. Recommendation: adopt behind a pilot with CI enforcement, treat it as build infrastructure rather than a convenience, and keep the exit path (fork or upstream the patch) explicitly open.

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.
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
equipc/laravel-email-database-log
adedsec/nova-translated-labels