PHP code example of anper / pdo-statement-collector

1. Go to this page and download the library: Download anper/pdo-statement-collector 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/ */

    

anper / pdo-statement-collector example snippets

 php
use Anper\Pdo\StatementCollector\Collector;
use function Anper\Pdo\StatementCollector\register_collector;

$pdo = new \PDO(...);

register_collector($pdo, $collector = new Collector());

// pdo queries...

foreach($collector->getProfiles() as $profile) {
    var_dump($profile);
}
 php
use Anper\Pdo\StatementCollector\Profile;
use function Anper\Pdo\StatementCollector\register_collector;

$collector = function (Profile $profile) {
    var_dump($profile);
};

register_collector($pdo, $collector);