edgaras/strsim
edgaras/strsim is a Laravel package for measuring and comparing string similarity. It helps power fuzzy search, typo-tolerant matching, duplicate detection, and suggestions with a simple, expressive API for ranking how alike two strings are.
Architecture fit
StringSimilarityContract so it is an implementation detail. This remains cheap (a few hours) and is what makes the single-maintainer risk tolerable.Integration feasibility
ext-mbstring is now declared. That floor happens to align with Laravel 10/11/12 baselines, so for a modern Laravel estate this is a non-issue — arguably a positive, since it signals the package tracks a supported runtime. For any service still on PHP 8.1 or older, this release is disqualifying until that upgrade lands.ext-mbstring must be confirmed present in every runtime image (common, but routinely omitted from minimal/slim containers and from some CI images). Add it to the base image checklist before the spike, not during it.composer require: no migrations, no credentials, no config publishing. Time-to-first-value is still minutes.Technical risk
phpunit.xml.dist, LICENSE, and .gitattributes are the marks of a project that intends to be installed and upgraded rather than a scratch repo. Forward-looking 8.5 coverage in particular reduces the "breaks silently on the next PHP major" scenario.memory_limit in queue workers. Caveats: the number is for one long-string workload, and rolling rows are straightforward for Levenshtein but less obvious for Damerau-Levenshtein, which needs lookback for transpositions. Verify the optimization covers the algorithms actually used.ext-mbstring and having Hamming reject invalid UTF-8 shows the maintainer is now thinking about encoding correctness. But the mitigation is unevenly evidenced: only Hamming's invalid-UTF-8 behavior is called out. Levenshtein, Damerau-Levenshtein, and Jaro-Winkler correctness on accented and non-Latin text still needs first-party fixtures. Note also that "rejects invalid UTF-8" is a behavior change — callers who previously fed legacy-encoded or binary-adjacent data through Hamming will now get a failure rather than a number.Key questions
ext-mbstring required by all algorithms or only some, and is it present in every runtime and CI image we use?levenshtein() / similar_text()?Stack fit
StringSimilarity contract in the domain layer, a StrSimSimilarity adapter, and a container binding. Keep the contract narrow — string measures plus, if needed, a single cosine method with an explicitly documented input shape.Migration path
levenshtein() + similar_text() + hand-rolled Jaro-Winkler. Lowest dependency risk, most code to own, and you inherit the performance work yourself.Compatibility
ext-mbstring against every target runtime before committing; either one missing is a blocker on that service.1.2.0) and commit the lock file for the first cycle. If v1.2.x proves stable, moving to a caret range is defensible given the new CI matrix and packaging hygiene — but only after the contract tests exist.Sequencing
ext-mbstring across target runtimes and images.Maintenance
Support
LICENSE, .gitattributes, phpunit.xml.dist) make local forking and vendoring cleaner than before, which is the practical form of support here.Scaling
pg_trgm, full-text) or a search engine, and reserve the package for re-ranking a bounded shortlist. Plan capacity around shortlist size.Failure modes
composer update.Ramp-up
ext-mbstring check and a Unicode spike. It remains a utility dependency, not a strategic one.How can I help you explore Laravel packages today?