digital-creative/conditional-container
Conditional Container for Laravel lets you render Blade components or HTML containers only when given conditions are met, keeping your views clean and readable. It supports flexible closures, gate checks, and inline conditionals for cleaner templates.
Architecture fit. This is a narrow, presentation-layer utility for Laravel Nova resources, not application infrastructure. It ships a ConditionalContainer field wrapper plus a HasConditionalContainer trait; adoption is a trait import and a wrapper around existing field arrays in fields(). There is no service provider surface worth reasoning about, no migrations, no persistence, no API contract change. The architecture fit question for a TPM is therefore binary: are we on Nova, and does our form complexity justify a dependency? If either answer is no, the evaluation closes.
Integration feasibility. Low effort, high uncertainty. The install is one Composer require plus a trait; the first container is a 10-line diff. The uncertainty is entirely in version compatibility: last release is May 2022 (v1.4.3), against a Nova major that has moved since. A TPM should treat this as a pilot-with-abort-criteria decision, not a blanket adoption.
Technical risk. Three concentrated risks, all manageable if framed correctly:
dist/js/ against a current Nova is the highest-probability failure. Pin to 1.4.3, test the exact production matrix in staging, and budget a fork-and-patch allowance.composer.json before sign-off.Key questions a TPM must answer before allocating a slot:
composer.json actually target, and does it match our admin stack today?dependsOn against src/ConditionalContainer.php, not the README?Stack fit. Adopt only if (a) the admin stack is Nova, verified from composer.json, and (b) our resources show enough conditional-field duplication to justify a shared wrapper. The package is presentation-only: it does not touch validation, persistence, domain logic, or customer-facing surfaces. That containment is the primary reason this is a low-blast-radius bet — it makes the review and QA surface small and revertible.
Migration path. There is no migration — this is additive. The pattern is per-resource adoption:
HasConditionalContainer to the resource; wire a single two-field dependency.billingContainer()) so the swap-out seam is one method per resource, not scattered.That "one method per resource" discipline is the migration path out as well — when native Nova logic or a fork replaces this, the edit is localized.
Compatibility. Pin 1.4.3 explicitly — do not float on ^1.4. Verify against the exact Nova/Laravel/PHP versions in production. Test create and update paths for every container shipped (v1.4.3's release note — "Check if field is shown on update" — is direct evidence that update-page visibility was a real bug). Include the closure-based dependsOn variant in the pilot; that is the API most likely to differ from assumptions.
Sequencing.
Do not sequence this as a strategic initiative. It is a sprint-sized admin UX improvement with an hours-scale rollback. If the pilot reveals a Nova-major incompatibility, that is the end of the evaluation — not a reason to invest in a fork unless the use cases are demonstrably valuable.
Maintenance. Near-zero until a Nova/PHP upgrade, at which point the lifecycle risk is concentrated entirely in that event. Do not schedule maintenance on a calendar cadence; schedule it against the Nova upgrade moment. Add the compatibility re-test to the upgrade checklist so it is not forgotten when the upgrade arrives.
Support. Single maintainer, zero dependents, last release 2022. This is not infrastructure; it is a utility. Frame it to stakeholders as contained, replaceable bet on a paid admin panel — not as a long-term platform commitment. The exit cost is hours, but only if someone on the team can read the field-rendering code. Identify that person during the pilot, not after a breakage.
Scaling. Zero runtime cost — admin UI only, off the request path. It does not affect API latency, database load, or customer experience. The scaling concern is not throughput; it is combinatorial QA surface: rules per container and nested containers (inside Repeater, Builder, nested containers) multiply field-instance state. Policy: prefer several small containers (one per state) over one container with a baroque multi-value condition; avoid nested containers unless tested; test every field type in the pilot, not just Text and Select.
Failure modes.
HasConditionalContainer is applied.dist/js/ conflicting with other Nova packages. Guard: debug via dd($this->fields(request())) to separate server-side resolution from browser-side rendering.required_if:…, sometimes), a feature test that submits condition-false with the dependent field populated, and a written statement in the PR description that visibility is not access control.Ramp-up. Low for engineers familiar with Nova resources — the API is one wrapper and one trait. The real ramp-up is organizational: get the team to internalize three rules — controllers above dependents, several small containers over one large one, server-side validation always. Encode those in the resource template or a short internal note; they are the difference between a clean adoption and a slow accumulation of nested-container debugging.
PM-level decision framing. This package converts hand-rolled conditional-visibility glue into a declarative resource definition — an MIT-licensed, reversible bet that buys back engineering time on back-office admin. The decision is "spend hours to save hours, if the pilot proves compatibility" — not "invest in admin UX strategy." Adopt only when the framework match is verified, compatibility is proven in staging, behavior is non-critical, and a named owner can read the field-rendering code if the vendor path closes. Otherwise, close the evaluation in ten minutes.
How can I help you explore Laravel packages today?