conserto / pomm-foundation
Pomm connection manager for Postgresql
Requires
- php: >=8.4
- ext-pgsql: *
- psr/log: ^2.0 || ^3.0
Requires (Dev)
- atoum/atoum: ^4.0
- friendsofphp/php-cs-fixer: ^3.65
- phpstan/phpstan: ^2.0
- rector/rector: ^2.0
- dev-main
- 5.0.x-dev
- 4.0.x-dev
- 4.0.5
- 4.0.4
- 4.0.3
- 4.0.2
- 4.0.1
- 4.0.0
- 3.2.4
- 3.2.3
- 3.2.2
- 3.2.1
- 3.2.0
- 3.1.2
- 3.1.1
- 3.1.0
- 3.0.x-dev
- 3.0.0
- 2.0.x-dev
- 2.0.5
- 2.0.4
- 2.0.3
- 2.0.2
- 2.0.1
- 2.0.0
- 2.0.0-rc.3
- 2.0.0-rc.2
- 2.0.0-rc.1
- 2.0.0-beta.2
- 2.0-beta-1
- dev-migrate-phpunit
- dev-cs-fixer
- dev-feat/improvements
- dev-fix/enum
- dev-feat/enum-converters
- dev-Fix-dsn-parsing
- dev-bump_version
- dev-primary_error_msg
- dev-throws_annotations
- dev-mdou/enum-converter
- dev-fix/prepared_query_in_preparation
- dev-report_forked_fixes_and_improvements
- dev-develop
This package is auto-updated.
Last update: 2026-05-05 14:24:35 UTC
README
This is a maintained fork of pomm-project/foundation by Grégoire HUBERT. Conserto maintains this fork to keep the library working on modern PHP versions, ship bug fixes, and extend the converter stack. Issues and pull requests should be filed against this repository.
Differences from upstream
- PHP 8.4+ required (upstream targeted PHP 8.1).
- Rector-driven modernization of type declarations and PHP 8.x syntax.
- Extra converters and enum compatibility:
PgBackedEnum, enum-awarePgString/PgInteger/PgFloat. - Active CI on PHP 8.4 and 8.5.
- See CHANGELOG for the detailed release history.
What is Foundation ?
Foundation is the main block of Pomm database framework. It makes clients able to communicate either with the database or with each others through a session. One of these clients -- the query manager -- can make Foundation to be used as DBAL replacement. If you are looking for a library to use PostgreSQL in your web development, you might want to look at Pomm’s model manager. If you want to create a custom database access layer or just perform SQL queries, Foundation is the right tool.
Foundation provides out of the box:
- Converters (all built-in Postgresql types are supported + arrays, HStore etc.) see this SO comment.
- Prepared Queries.
- Parametrized queries.
- Seekable iterators on results.
- LISTEN / NOTIFY asynchronous messages support.
- Service manager for easy integration with dependency injection containers.
Requirements
- PHP >= 8.4
- ext-pgsql (not PDO)
- PostgreSQL (tested on recent versions; older ones may work but are not covered by CI)
Installation
This fork is distributed on Packagist as conserto/pomm-foundation. Add it with Composer:
composer require conserto/pomm-foundation
Note: It is important the PHP configuration file defines the correct timezone setting. Pomm also sets the PostgreSQL connection to this timezone to prevent time shifts between the application and the database.
Documentation
Foundation’s documentation is available either online or directly in the documentation folder of the project.
Tests
This package uses Atoum as unit test framework. The tests are located in sources/tests. The test suite needs to access the database to ensure that read and write operations are made in a consistent manner. You need to set up a database for that and fill the sources/tests/config.php file with the according DSN. For convenience, Foundation provides two classes that extend Atoum with a Session:
PommProject\Foundation\Tester\VanillaSessionAtoumPommProject\Foundation\Tester\FoundationSessionAtoum
Making your test class to extend one of these will grant them with a buildSession method that returns a newly created session. Clients of these classes must implement a initializeSession(Session $session) method (even a blank one). It is often a good idea to provide a fixture class as a session client, this method is the right place to register it.
Known bugs
Unfortunately there is a bug we can not fix easily or without degrading performances of the whole stack:
- The
ConvertedResultIteratorcan not recognize custom composite types when they are defined in schemas other thanpublic. This is because thepg_typefunction does not return the schema the type belongs to. There are not turns around unless the schema is inspected manually by issuing a lot of queries. (see #53)
License
Foundation is released under the MIT license — see LICENSE. Original copyright © 2014 Grégoire HUBERT, fork maintenance © 2022-present Conserto.