diff --git a/composer.json b/composer.json index 748addb..001453c 100644 --- a/composer.json +++ b/composer.json @@ -20,7 +20,8 @@ "source": "https://github.com/Vectorface/MySQLite" }, "require": { - "php": "^8.0.0" + "php": "^8.0.0", + "ext-pdo": "*" }, "require-dev": { "phpunit/phpunit": "^9", diff --git a/src/Vectorface/MySQLite/MySQL/StringFunctions.php b/src/Vectorface/MySQLite/MySQL/StringFunctions.php index 0050adc..a945096 100644 --- a/src/Vectorface/MySQLite/MySQL/StringFunctions.php +++ b/src/Vectorface/MySQLite/MySQL/StringFunctions.php @@ -50,4 +50,12 @@ public static function mysql_format() $decimals = isset($args[1]) ? $args[1] : 0; return number_format($number, $decimals); } + + /** + * Get the soundex value of a given string + */ + public static function mysql_soundex(string $str): string + { + return soundex($str); + } } diff --git a/tests/Vectorface/Tests/MySQLite/MySQLiteTest.php b/tests/Vectorface/Tests/MySQLite/MySQLiteTest.php index 08d6437..6dd9175 100644 --- a/tests/Vectorface/Tests/MySQLite/MySQLiteTest.php +++ b/tests/Vectorface/Tests/MySQLite/MySQLiteTest.php @@ -169,4 +169,9 @@ public function testFormat() $test = MySQLite::mysql_format("12.232", 1); $this->assertEquals($expected, $test); } + + public function testSoundex() + { + $this->assertEquals("F000", MySQLite::mysql_soundex("foo")); + } }