PHP code example of anonymous-php / longlife-pdo

1. Go to this page and download the library: Download anonymous-php/longlife-pdo 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/ */

    

anonymous-php / longlife-pdo example snippets




use \Anonymous\Longlife\LonglifePdo;

$pdo = new LonglifePdo('mysql:host=127.0.0.1;dbname=test', 'test', 'test');

// To check connection in 60 seconds after the last connection usage
$pdo->setCheckConnectionTimeout(60);

// To use prepared statements cache and limit it with 100 items
$pdo->setStatementsCacheLimit(100);

composer