kalessil/production-dependencies-guard
A Composer plugin that guards production installs by detecting dev-only dependencies and blocking them from leaking into production builds. It adds a safety check so accidental require-dev packages or non-production installs are caught early.
require-dev" from a wiki page into a hard gate at composer require time. That's a policy decision — do we trust reviewers, or do we automate the rule? — and this package is the cheapest way to pick "automate."composer.json require sections. At 83 stars and zero dependents, this is a buy/adopt-with-caveats decision, not a strategic platform bet: it's a small, single-purpose tool you can vendor, fork, or replace in an afternoon if it stalls.require ships into production vendor/, inflates container images, widens the CVE surface scanned by security tooling, and pollutes SBOMs. If your roadmap includes slimming deploy artifacts or tightening supply-chain posture, this is a concrete, low-effort contributor.require block becomes your consumers' dependency graph. Shipping PHPUnit or a mocking library as a hard dependency is a product defect in the eyes of downstream users — this package prevents that class of defect at authoring time.composer.json, the plugin acts as a consistent referee regardless of who reviews the PR, which reduces review load and cross-team nitpicking.composer.json churn is high.Adopt when:
composer.json, or you publish packages externally.composer install; the plugin adds no meaningful runtime or pipeline cost.Look elsewhere or skip when:
composer-unused, roave/security-advisories, Deptrac, or static analysis in CI. This package only answers one narrow question.require against an allow-list would satisfy the same requirement with zero third-party code.To executives (one paragraph): This is a small, free, MIT-licensed guardrail that stops development-only libraries from being declared as production dependencies in our PHP services. The business effect is narrow but real: leaner production deployments, a smaller attack surface for security scanners, and cleaner software bills of materials — enforced automatically instead of relying on reviewer vigilance. Cost is a few minutes of setup, there is no runtime overhead, and it can be removed as easily as it's added. The caveat worth stating plainly is that it's a single-maintainer open-source project with modest adoption, so we should pin it, keep it out of any critical path, and treat it as a hygiene measure rather than a security control.
To engineering: It's a Composer plugin that intercepts composer require and refuses packages that belong in require-dev, with an override for legitimate exceptions. Install is a single dev dependency plus a plugin allow-list entry; behavior is deterministic and fast, so it belongs in local dev and CI alike. Expect occasional false positives on unusual package metadata — budget a short tuning window and document the escape hatch in the contributing guide. Because upstream activity is thin, we should pin an exact version, read the source (it's small), and keep a fallback CI check ready so a stale dependency never becomes a blocker. Treat the decision as reversible: the exit cost is an afternoon, which is what makes it a safe experiment.
How can I help you explore Laravel packages today?