PHP code example of getcodedev / test-levenshtein

1. Go to this page and download the library: Download getcodedev/test-levenshtein library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

getcodedev / test-levenshtein example snippets


$duplicates = check_duplicates(
    model: User::class,
    search: [
        'first_name' => 'John',
        'home' => [
            'address' => "bbbbb, rrr BB, 77777",
        ],
    ],
    concat_search_columns: [
        'home' => [
            'address' => 'homes.street, homes.city homes.state, homes.zip',
        ],
    ],
    priority_columns: [
        'homes.address',
        'users.first_name',
    ],
    with_similarity_min_common: 50,
    limit: 10
);
bash
php artisan vendor:publish --tag="test-levenshtein-migrations"
php artisan migrate