PHP code example of koriym / query-locator

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

    

koriym / query-locator example snippets


use Koriym\QueryLocator\QueryLocator;

// Define the directory where your SQL files are stored
$sqlDir = 'path/to/sql/files';

// Instantiate the QueryLocator
$query = new QueryLocator($sqlDir);

// Retrieve a query
$sql = $query['admin/user']; // This will load the contents of 'admin/user.sql'

// Retrieve a count query
$countSql = $query->getCountQuery('admin/user'); // This will generate 'SELECT COUNT(*) FROM user'