PHP code example of sarfraznawaz2005 / indexer

1. Go to this page and download the library: Download sarfraznawaz2005/indexer 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/ */

    

sarfraznawaz2005 / indexer example snippets


Sarfraznawaz2005\Indexer\ServiceProvider::class,

'watched_tables' => [
    'users' => [
        // list of already existing indexes to try
        'try_table_indexes' => ['email'],
        // new indexes to try
        'try_indexes' => ['name'],
        // new composite indexes to try
        'try_composite_indexes' => [
            ['name', 'email'],
        ],
    ],
],

'watched_tables' => [
    'users' => [
        'try_table_indexes' => ['email'],
    ],
    'posts' => [
        'try_table_indexes' => ['title'],
    ]
],

// php
function indexerOptimizedKeyCustom(array $query): string
{
    return trim($query['explain_result']['key']);
}
 
bash
php artisan vendor:publish --provider="Sarfraznawaz2005\Indexer\ServiceProvider"
`javascript
// javascript
function indexerOptimizedKeyCustom(explain_result) {
    return explain_result['key'] && explain_result['key'].trim();
}