Download the PHP package fza/mysql-doctrine-levenshtein-function without Composer
On this page you can find all versions of the php package fza/mysql-doctrine-levenshtein-function. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download fza/mysql-doctrine-levenshtein-function
More information about fza/mysql-doctrine-levenshtein-function
Files in fza/mysql-doctrine-levenshtein-function
Package mysql-doctrine-levenshtein-function
Short Description Provides the `LEVENSHTEIN()` and `LEVENSHTEIN_RATIO()` MySQL functions for Doctrine2.
License MIT
Informations about the package mysql-doctrine-levenshtein-function
Levenshtein distance function for Doctrine and MySQL
A tiny Doctrine extension for the Levenshtein distance algorithm to be used directly in DQL. The LEVENSHTEIN(s1, s2)
function returns the number of add, replace and delete operations needed to transform one string into another. The LEVENSHTEIN_RATIO(s1, s2)
function returns the similarity of two strings in percent (0 <= x <= 100
). They work in much the same way as the PHP built-in functions: levenshtein(), similar_text().
Just for reference, there are plenty of alternative/additional algorithms to compute phonetic similarity. This is by all means not a complete list:
- Damerau-Levenshtein distance
- Jaro-Winkler distance (there is a Doctrine extension available as well)
- Soundex
- Metaphone
Define MySQL functions
Execute the following commands to define the LEVENSHTEIN
and LEVENSHTEIN_RATIO
functions in the database. This needs to be done before you can use the functions in any query.
Symfony2 configuration
Query example
License
Copyright (c) 2015 Felix Zandanel
Licensed under the MIT license.
See LICENSE for more info.