PHP code example of zvook / php-postgresql-stat

1. Go to this page and download the library: Download zvook/php-postgresql-stat 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/ */

    

zvook / php-postgresql-stat example snippets


use zvook\PostgreStat;

$dbName = 'my_db';
$dbUser = 'my_user';
$dbPass = 'my_pass';

$pgStat = new PgStat($dbName, $dbUser, $dbPass);

# Get basic DB statistic
# Returns instance of zvook\PostgreStat\Models\DbStat
$pgStat->getDbStat();

# Get detailed tables statistic
# Returns an array of zvook\PostgreStat\Models\TableStat instances
$pgStat->getTablesStat();

# Get user functions statistic
# Returns an array of zvook\PostgreStat\Models\FunctionStat instances
$pgStat->getFunctionsStat();

# Get indexes statistic
# Returns an array of zvook\PostgreStat\Models\IndexStat instances
$pgStat->getIndexesStat();

# Get statements
# Returns an array of zvook\PostgreStat\Models\StatementStat instances
$pgStat->getStatementsStat();

# Get useless indexes (analytic)
# Returns the same as getIndexesStat()
$pgStat->getUselessIndexes();

# Get missing indexes (analytic)
# Returns the same as getTablesStat()
$pgStat->getLowIndexUsageTables();
json
""zvook/php-postgresql-stat": "*"
}
bash
php demo.php > demo.html