PHP code example of tumtum / sw6-sql-logger

1. Go to this page and download the library: Download tumtum/sw6-sql-logger 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/ */

    

tumtum / sw6-sql-logger example snippets


\StartSQLLog();

$result = $this->productRepository->search(new Criteria(['product.id']), $context);

\StopSQLLog();

\StartSQLLog(useVarDumper: true);

ray()->showQueries()

// This query will be displayed.
$this->productRepository->search(new Criteria(['product.id']), $context);

ray()->stopShowingQueries();

// This query won't be displayed.
$this->productRepository->search(new Criteria(['product.id']), $context);

// This query won't be displayed.
$this->productRepository->search(new Criteria(['product.id']), $context);

ray()->showQueries(function() {
    // This query will be displayed.
    $this->productRepository->search(new Criteria(['product.id']), $context); 
});

$users = ray()->showQueries(function () {
    // This query will be displayed and the collection will be returned.
    return $this->productRepository->search(new Criteria(['product.id']), $context);
});

$this->productRepository->search(new Criteria(['product.id']), $context); // this query won't be displayed.

#Classic
\StartSQLLog(useRayDumper: true);