PHPackages                             zvook/php-postgresql-stat - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Logging &amp; Monitoring](/categories/logging)
4. /
5. zvook/php-postgresql-stat

ActiveLibrary[Logging &amp; Monitoring](/categories/logging)

zvook/php-postgresql-stat
=========================

PHP PostgreSQL statistic monitoring tool

1.2.0(9y ago)045MITPHPPHP &gt;=5.6.0

Since Feb 22Pushed 9y ago1 watchersCompare

[ Source](https://github.com/zvook/php-postgresql-stat)[ Packagist](https://packagist.org/packages/zvook/php-postgresql-stat)[ Docs](https://github.com/zvook/php-postgresql-stat)[ RSS](/packages/zvook-php-postgresql-stat/feed)WikiDiscussions master Synced yesterday

READMEChangelogDependencies (1)Versions (4)Used By (0)

PHP tool for monitoring PostgreSQL statistic
============================================

[](#php-tool-for-monitoring-postgresql-statistic)

[![Latest Stable Version](https://camo.githubusercontent.com/e0db99c6858041397f93e5b53453c7eb8fa0bc70523dfd5ed7458129d22e4654/68747470733a2f2f706f7365722e707567782e6f72672f7a766f6f6b2f7068702d706f737467726573716c2d737461742f762f737461626c65)](https://packagist.org/packages/zvook/php-postgresql-stat)[![Total Downloads](https://camo.githubusercontent.com/133b51828c1df63462292f49a1baf26348035caa87058ec290e57d02c8f89301/68747470733a2f2f706f7365722e707567782e6f72672f7a766f6f6b2f7068702d706f737467726573716c2d737461742f646f776e6c6f616473)](https://packagist.org/packages/zvook/php-postgresql-stat)[![License](https://camo.githubusercontent.com/c8af937819eb50f02ee8b26f7ec4eebb72322b186b30f73aceb4c10108b67419/68747470733a2f2f706f7365722e707567782e6f72672f7a766f6f6b2f7068702d706f737467726573716c2d737461742f6c6963656e7365)](https://packagist.org/packages/zvook/php-postgresql-stat)

### Requirements

[](#requirements)

- PHP 5.6+
- PostgreSQL 9.2+ (9.5+ recommended)

### Containing

[](#containing)

- Database statistic
- Tables statistic
- Indexes statistic
- Functions statistic
- Statements
- Useless/Missing indexes analytic

### Installation

[](#installation)

- Update your *postgresql.conf*

```
shared_preload_libraries = 'pg_stat_statements'
track_counts = on #enabled by default
track_functions = on #if you need it
track_io_timing = on #optional
```

- Then connect to the **database you want to track** with user you will use to connect (**not with postgres user!**) and run:

```
CREATE EXTENSION pg_stat_statements
```

!Please note that you should run SQL above exactly **inside** your database and **exactly** by your backend user

- Restart postgre server
- Add to your composer.json

```
"require": {
    "zvook/php-postgresql-stat": "*"
}
```

- Run

```
$ composer update
```

### Demo

[](#demo)

When package installed and postgreSQL configured you can build demo page to observe the situation. Go to the package root directory and edit **demo.php** with your database credentials. Then run:

```
php demo.php > demo.html
```

Open demo.html with browser

### Basic Usage

[](#basic-usage)

!Please not that pg\_stat\_statements needs a time for collecting statistic to provide you adequate information

```
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();
```

Also you can find complete usage example in **demo.php** in the root dir of the package

### Information

[](#information)

- [PostgreSQL Statistics](https://www.postgresql.org/docs/9.5/static/monitoring-stats.html)
- [PostgreSQL Statements](https://www.postgresql.org/docs/9.5/static/pgstatstatements.html)

###  Health Score

26

—

LowBetter than 41% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity60

Established project with proven stability

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~0 days

Total

3

Last Release

3416d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/8e0bebc6a6396c925fdcbb731527fa708d43a66ab469c61b689949ffd8ff80d6?d=identicon)[xaerobiont](/maintainers/xaerobiont)

---

Top Contributors

[![xaerobiont](https://avatars.githubusercontent.com/u/5050758?v=4)](https://github.com/xaerobiont "xaerobiont (7 commits)")

---

Tags

phpmonitoringpostgresqlstatistic

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/zvook-php-postgresql-stat/health.svg)

```
[![Health](https://phpackages.com/badges/zvook-php-postgresql-stat/health.svg)](https://phpackages.com/packages/zvook-php-postgresql-stat)
```

###  Alternatives

[ptrofimov/beanstalk_console

Admin console for Beanstalk queue server

1.3k126.1k](/packages/ptrofimov-beanstalk-console)[inspector-apm/inspector-php

Inspector monitoring for PHP applications.

353.0M29](/packages/inspector-apm-inspector-php)[bacula-web/bacula-web

The open source web based reporting and monitoring tool for Bacula

1557.6k](/packages/bacula-web-bacula-web)[treblle/treblle-php

Runtime Intelligence Platform

2084.4k2](/packages/treblle-treblle-php)[inspector-apm/inspector-symfony

Code Execution Monitoring for Symfony applications.

2839.2k9](/packages/inspector-apm-inspector-symfony)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
