k2gl/entity-exist
k2gl/entity-exist is a lightweight Laravel package for checking whether an entity exists before your app acts on it. It provides simple, reusable existence checks for guard clauses, validation flows, and safe record lookups, helping keep null-related errors out of your code.
Constraint + ConstraintValidator pair in-house.Adopt only if all of the following hold:
exists / unique validation rules instead. This alone disqualifies it for most Laravel shops.Look elsewhere (or write it yourself) when:
To executives: A small, MIT-licensed utility that turns "that ID doesn't exist" from a crash into a clean validation message. The cost is near zero and the risk is contained by pinning the version — but it is a convenience, not a strategic capability, and it does not improve data integrity beyond what our database already enforces. Recommendation: low priority; approve only as a tactical cleanup inside an existing Symfony/Doctrine service.
To engineering: Drop-in Symfony constraint with positive and negated existence assertions over Doctrine. It removes boilerplate from form types and standardizes the unknown-reference error path. Caveats to weigh in review: it's effectively a single-maintainer package with no dependents, so we should verify Doctrine/Symfony version support, check test coverage, and be prepared to fork. If we're not already on Symfony + Doctrine, the answer is no — and even if we are, "write the 50-line validator ourselves" is a legitimate competing option that removes the dependency entirely.
How can I help you explore Laravel packages today?