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.
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.
allow-plugins gating: if not whitelisted, the plugin is silently ignored and patches vanish.composer.lock; reproducibility depends on plugin version + patch files + application order.--no-plugins builds.Key questions.
composer-plugin-api versions are supported against our pinned Composer release?composer install from lock in CI, and how does that interact with vendor caching, --no-scripts, and --no-plugins?cweagans/composer-patches?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.
patches/, named <package>-<ticket>-<seq>.patch, each linked to an upstream issue.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.
allow-plugins, cached vendor) → a production bug that reads as an upstream regression. This is the dangerous one.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.
How can I help you explore Laravel packages today?