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

Levenshtein Bundle Laravel Package

jrk/levenshtein-bundle

jrk/levenshtein-bundle offers Levenshtein distance utilities for PHP, useful for comparing strings, fuzzy matching, spelling suggestions, and similarity checks. A lightweight, low-adoption package; review suitability before production use.

View on GitHub
Deep Wiki
Context7

Product Decisions This Supports

  • Typo-tolerant back-office search — with a hard ceiling. The package's single capability is registering a Levenshtein (edit-distance) function inside Doctrine's DQL, so a query can express "find records within N edits of this input." That supports "did you mean…", forgiving admin lookup, and fuzzy matching on internal screens where result quality and latency are not contractual.
  • Duplicate detection and merge-review queues. Distance thresholds are a cheap way to surface likely-duplicate contacts, suppliers, or imported catalog rows for human confirmation. This is a genuinely useful product decision — ship dedup triage now, defer a real entity-resolution system — and it is the strongest use case here because it can run offline in a batch job rather than on a request path.
  • Post-import data-quality triage. Flagging near-miss rows after a CSV ingest is a legitimate, bounded feature where a full scan over tens of thousands of rows is acceptable.
  • Build vs. buy — resolved as "build." The package is a thin wrapper, not a platform. The buy option saves an afternoon and costs an unmaintained Symfony 2-era dependency. The correct framing for the roadmap is a small in-house utility, not a vendor evaluation.
  • Explicitly not supported: search as a product surface. Row-wise edit distance cannot use an index and forces a sequential scan with per-row O(n·m) work. That rules out public search endpoints, autocomplete, relevance ranking, multi-field matching, and multilingual behavior. It also rules out any decision where fuzzy matching sits on the hot path or where latency is a stated requirement.

When to Consider This Package

Consider it only when all of the following hold:

  • The host application is an existing, maintained Symfony 2 / early Doctrine 2.x codebase — the only environment where the bundle's service and DQL registration actually wire up. Despite being filed under a Laravel/PHP package review, this ships no Laravel service provider, facade, or Eloquent integration; in an Eloquent app, architectural fit is zero.
  • The dataset is small and the query is infrequent — admin screens, internal tooling, nightly jobs. A reasonable working bound is tens of thousands of rows at low query volume.
  • No better-indexed alternative exists in the stack: no Postgres pg_trgm with a GIN index, no MySQL FULLTEXT, no Meilisearch/Typesense/Elasticsearch, and adding one is disproportionate to the feature.
  • Your database platform permits a server-side LEVENSHTEIN routine (a compiled UDF or stored function). Managed offerings such as RDS/Aurora, Cloud SQL, and Azure Database generally forbid or gate this behind elevated parameter groups — a DBA/platform approval you should scope before, not after, committing to the approach.
  • You are willing to vendor or fork the code and assign internal ownership. The maintenance signal is weak: 2 stars, 0 dependents, a Symfony 2 target that reached end of life in 2019, no visible tests or CI, and a 0.1 quality score.

Look elsewhere when:

  • You are building anything new on Symfony 5/6/7 or Laravel. The DQL integration will not port, and the underlying logic is roughly 30–50 lines you can own outright.
  • Search quality or latency is a product requirement. Use pg_trgm with a GIN index, MySQL full-text, or a dedicated engine — indexed fuzzy matching instead of per-row computation.
  • You need ranking, relevance scoring, multi-field matching, or multilingual behavior. A raw edit-distance function provides none of these.
  • Supply-chain hygiene matters. Zero dependents and a dormant repository mean no upstream fixes and no CVE path. A copy of the DQL function into your own codebase is the lower-risk option and gives you tests, attribution, and ownership.
  • Application-layer comparison is sufficient. PHP's native levenshtein() or symfony/string's Levenshtein::distance() covers in-process comparison with no database dependency at all — this should be the default spike before any DB-side work.

How to Pitch It (Stakeholders)

To executives: This is a small legacy utility, not a strategic dependency. It adds fuzzy string matching to database queries for internal tools — "did you mean…" and duplicate detection in back-office workflows — and it belongs in an existing Symfony 2 application, not on the roadmap as a component. Signal strength is low: 2 stars, no downstream users, and a target framework that has been unsupported since 2019. Recommendation: copy the roughly 50 lines of logic internally and keep the dependency count at zero. Cost is one engineering afternoon; the alternative is inheriting unmaintained code plus a database-platform approval we would have to negotiate anyway. If fuzzy search ever becomes a user-facing requirement, the migration target is a proper search index, and this function should be retired at that point — so treat any investment here as deliberately temporary.

To engineering: It is a Doctrine DQL custom function that exposes Levenshtein distance to the query builder. The value is ergonomic, not technical — the algorithm is trivial to reimplement — and the Symfony 2 bundle wrapper has no meaning in a modern container, so do not composer require it into main. Read the FunctionNode class as a specification and rewrite it against the Doctrine version we actually run, or skip the database entirely and use symfony/string or native levenshtein() in application code. Be explicit about the operational profile: it computes per row, cannot use an index, and becomes a sequential scan on any non-trivial table — fine behind an admin screen or a batch job, wrong for a public search endpoint. Three failure modes to design against: the server-side UDF missing on a newly provisioned or read-replica environment (production-only SQL errors), a managed-database policy change revoking the routine, and utf8mb4 collation mismatch causing silently incorrect distances rather than exceptions — the worst class, because results look plausible. Verify the platform permits CREATE ROUTINE, confirm the collation, assign internal ownership, and write tests; none of that comes with the package.

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.
novasa/laravel-language-center
opencage/geocode
adolfoholzer/parameters
livenetworks/ln-starter
shitoudev/permissionmanager
johannesclimacus/laravel-tui
hocvt/seotools
vitalybaev/sypexgeo
amphibee/themosis-ignition
gito-me/fast-excel
frankyso/laravel-ipaymu
geolize-studio/laravel-chile
boomerangui/chat
cgv/localized-resource
noith/settings
kda/laravel-package
kda/filament-dynamic-navigation
bypersoft/signbox
pairus/product-data
fayne/laravel-filament-cms-core