PHPackages                             derekchan/pg-php - 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. [HTTP &amp; Networking](/categories/http)
4. /
5. derekchan/pg-php

ActiveLibrary[HTTP &amp; Networking](/categories/http)

derekchan/pg-php
================

An implementation of the Postgres TCP protocol in pure PHP

0.0.1(10y ago)1195LGPLPHPPHP &gt;=5.3.0

Since Aug 7Pushed 8y ago2 watchersCompare

[ Source](https://github.com/derekchan/PgPhp)[ Packagist](https://packagist.org/packages/derekchan/pg-php)[ RSS](/packages/derekchan-pg-php/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (1)DependenciesVersions (2)Used By (0)

PgPhp - An implementation of the postgre protocol in pure PHP
=============================================================

[](#pgphp---an-implementation-of-the-postgre-protocol-in-pure-php)

A pure PHP PostgreSQL connector that works - sometimes you just need a quick and dirty way to connect to PostgreSQL, but for any reasons you do not have access to the native driver, and you do not care about performance.

*Currently only works in Linux / UNIX-like environment as it depends on "/usr/bin/hexdump"*

### Usage

[](#usage)

See [examples.php](examples.php)

### Installation

[](#installation)

```
composer require derekchan/pg-php

```

From the original author (@BraveSirRobin)
-----------------------------------------

[](#from-the-original-author-bravesirrobin)

### Development status

[](#development-status)

Development status : Toy. Works for me, and it supports the protocol COPY command too, which is nice.

### Motivation

[](#motivation)

I wrote this library as a proof of concept and to learn a bit more about different TCP protocols. The main (only?) reason for wanting to do this is to be able to write an "Event Machine" / "Twisted" type of server where you can do asynchronous I.O. to several different kinds of application endpoint, e.g. RabbitMQ, Postgres, MySql, HTTP, etc. etc.

### Future

[](#future)

Currently, and for the forseeable future I'll be devoting my "open source" time to my [Amqphp project](https://github.com/BraveSirRobin/amqphp), but eventually I'd like to expand this to be a fast, fully asyncronous, PHP-implemented "business process server".

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity12

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity48

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 85% 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

Unknown

Total

1

Last Release

3938d ago

### Community

Maintainers

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

---

Top Contributors

[![BraveSirRobin](https://avatars.githubusercontent.com/u/549224?v=4)](https://github.com/BraveSirRobin "BraveSirRobin (34 commits)")[![derek9gag](https://avatars.githubusercontent.com/u/14237112?v=4)](https://github.com/derek9gag "derek9gag (4 commits)")[![derekchan](https://avatars.githubusercontent.com/u/1776133?v=4)](https://github.com/derekchan "derekchan (2 commits)")

### Embed Badge

![Health badge](/badges/derekchan-pg-php/health.svg)

```
[![Health](https://phpackages.com/badges/derekchan-pg-php/health.svg)](https://phpackages.com/packages/derekchan-pg-php)
```

###  Alternatives

[friendsofsymfony/rest-bundle

This Bundle provides various tools to rapidly develop RESTful API's with Symfony

2.8k73.3M319](/packages/friendsofsymfony-rest-bundle)[php-http/discovery

Finds and installs PSR-7, PSR-17, PSR-18 and HTTPlug implementations

1.3k309.5M1.2k](/packages/php-http-discovery)[pusher/pusher-php-server

Library for interacting with the Pusher REST API

1.5k94.8M293](/packages/pusher-pusher-php-server)[react/http

Event-driven, streaming HTTP client and server implementation for ReactPHP

78026.4M414](/packages/react-http)[php-http/curl-client

PSR-18 and HTTPlug Async client with cURL

48347.0M384](/packages/php-http-curl-client)[smi2/phpclickhouse

PHP ClickHouse Client

84310.1M71](/packages/smi2-phpclickhouse)

PHPackages © 2026

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