- 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.