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
Entity Exist

Entity Exist Laravel Package

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.

View on GitHub
Deep Wiki
Context7

k2gl/entity-exist is a lightweight Laravel/PHP package for checking whether an entity exists before your application acts on it. It provides a focused, reusable way to guard lookups and keep controllers and services free of repetitive existence logic.

  • Simple existence checks for entity lookups
  • Model-agnostic design for Laravel applications
  • Helps reduce boilerplate in controllers and services
  • Easy to combine with validation and authorization flows
  • Lightweight with minimal dependencies
Frequently asked questions about Entity Exist
Does k2gl/entity-exist work with Laravel?
No. It is a Symfony Validator constraint resolved by Doctrine's EntityManager, while Laravel validates through illuminate/validation. There is no shared extension point, so a Symfony constraint cannot be registered with Laravel's validator without bridging the entire Symfony Validator component. For Laravel-only apps, the evaluation should stop here.
How do I install k2gl/entity-exist in a Laravel application?
Installing it would bring symfony/validator and doctrine/orm into a Laravel app, creating a second persistence layer alongside Eloquent with separate connection config and migrations. That is a high cost for behavior Laravel already provides. The package is not designed for Laravel's validation pipeline, so installation is not recommended for Laravel-only services.
What is the Laravel equivalent of k2gl/entity-exist?
Laravel ships exists:table,column, unique, and Rule::exists()->where() for database existence checks. For model-aware checks, write a custom ValidationRule that accepts a model class or repository contract. The TPM assessment estimates this as roughly 50 lines of code.
Can I use a Symfony validation constraint in Laravel's validator?
Not directly. Laravel rules implement ValidationRule::passes($attribute, $value) and are resolved from the container; Symfony constraints are applied as attributes or annotations on Doctrine entities and resolved by a ConstraintValidator. Bridging them means integrating the Symfony Validator component, which is a framework mismatch rather than a simple wiring gap.
Does k2gl/entity-exist support tenant scoping and soft deletes?
The provided context gives no evidence that it supports scoping for tenant, soft-delete, status, or ignore-ID semantics. Existence checks are security-sensitive, so opaque behavior is a governance risk. Build an explicit Laravel rule with options for target column, ignore-ID, additional where constraints, withTrashed or onlyTrashed, and tenant scope.
Which Laravel versions are supported by k2gl/entity-exist?
It is not a Laravel package, so Laravel version support is not the relevant axis. The TPM assessment places it in Symfony 5/6/7 plus Doctrine ORM 2/3 territory. Do not assume Laravel compatibility from the Composer name or blurb.
Is k2gl/entity-exist production ready?
The assessment reports one star, zero dependents, no production evidence, and a bus factor of one. The stated last release date is ahead of the current date, which must be verified before pinning anything. It is not defensible as a production dependency in a Laravel estate.
How do I test entity existence validation in Laravel?
Test a native Laravel rule against a database using RefreshDatabase, asserting passes for existing rows and fails for missing rows. Cover tenant isolation, soft-deleted records, ignore-ID on updates, and additional where clauses. Testing the Symfony constraint inside Laravel would require a dual ORM setup and would not exercise Laravel's validator.
What are the alternatives to k2gl/entity-exist for Laravel?
Use Laravel's built-in exists rule, Rule::exists()->where() for scoped checks, or a small custom ValidationRule for model-aware logic. Ship the custom rule in app/Rules or an internal package so all services share one audit surface. If a legacy Symfony service exists, keep k2gl/entity-exist isolated to that repository.
How do I build a custom Laravel exists rule with tenant and soft-delete support?
Implement ValidationRule::passes($attribute, $value) and accept a model class or repository contract rather than a raw table string. Add explicit options for target column, ignore-ID for updates, extra where constraints, withTrashed or onlyTrashed, and tenant scope from authenticated context. Return a clear validation failure and fail closed when scope cannot be determined.
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.
users-au/socialite-provider
twidpay/twid-logger
mrnewport/laravel-plaid
mrnewport/laravel-repo
mrnewport/laravel-docsign
mrnewport/laravel-stow
mrnewport/laravel-flow
mrnewport/laravel-priceable
mrnewport/laravel-nestedterms
fredmeng/laravel-apidoc-generator
itstructure/laravel-multilingual-tools
pdustdar/elasticsearch
markupai/php-sdk
rlacerda83/lumem-microservice-shipment
uni-method/symfony-lib
tacticmedia/scim-server-bundle
neika-ai/symfony-bundle
mattleads/agent-publishing-bundle
glavweb/framework-bundle
glavweb/extra-bundle