More than one year after bootstrapping the first lines of code, the complete rewrite of Pomm is now production ready for everyone.

So, what’s in Pomm 2 ?

Pomm is a PHP database layer dedicated to Postgresql. It provides a different approach from classical DBAL and ORM: make the end developers able to use the database to keep the complexity out of their applications. Pomm offers:

a high level API to ease database access and security

unrestricted use of Postgresql’s ISO⋅2008 SQL

transparent type conversion for results and parameters

customizable converters

lazy and scrollable iterators on results

an extensible codebase to build custom model layers (useful to wrap legacy code)

a «projection to entity» model manager for crud and transactional operations

For convenience, Pomm2 has been split into several packages:

Foundation: the database access layer and configuration management (documentation)

ModelManager: an entity and transaction model manager (documentation)

Cli: a CLI tool to inspect database and generate model manager’s classes

Pomm’s model manager is a projection driven model layer. This is unusual for users used to ORM ans they may be confused at first place. The idea is to provide full SQL access to the developers while making the projection -- ie the list of fields returned by the query -- customizable. By relieving the developers of managing the list of fields the statements return, it makes them to focus more on what the queries are actually doing. The model manager is following its own opinionated guidelines:

The best place to structure the data is where they are the more constrained: the database.

There will be no query builder, SQL is a stateless and powerful data manipulation language.

Entities do not know what a database is hence they cannot issue background queries.

There are also add-ons to use Pomm with frameworks:

More informations and code examples can be found on «What is Pomm2».

Using Pomm2

Of course there are already websites running Pomm2 as database layer. Those who dared using the first beta version in their application did provide lot of interesting feedbacks that lead to improve Pomm until now. We recently collected feedbacks from early adopters about their use of Pomm2. Here is a synthesis of what most of them reported:

The main reason why people use Pomm is: Postgresql. It is one of the most advanced relational database engine out there in terms of functionalities and performances. Full text search, powerful SQL, smart types and operators make it a database of choice in mixing strongly typed, constrained structures with flexible NoSQL capabilities. Most of actual Pomm users wanted to leverage Postgres’ features in their PHP developments.

The main hard point reported was how to deal with the object manager as it really looks like an ORM and it is not. Most of the users are former ORM users (Doctrine, Eloquent etc.) where the relational concept of projection does not exist. The lack of documentation until recently also made hard to learn how to solve problems but once the first step was over, developers felt completely in control of what the code was doing. We had a couple of emails of thanks by people joyful not to bang their head against a heap of code between them and their database, thanks for sharing!

Pomm2 is used in a variety of different projects. A huge Zend application has been reported but also small REST APIs using micro frameworks like Silex or SlimPHP. There are a lot of medium sized websites with Sf2 and ZF2 as well, the integration with these frameworks seems good so far.

Words about performances: «good», «great», «perfect». We actually had one feedback of people migrating from an ORM to Pomm because of the performances boost, thank you for reporting.

Roadmap

We had a lot of requests about Pomm’s roadmap. It as simple as semver. To make it short:

Pomm 2.0.x will not introduce new features (only bug fix and security issues).

will not introduce new features (only bug fix and security issues). Pomm 2.x will be backward compatible.

We do already have features open for the 2.1 release but after 1 year of work, we feel the project must live so we can keep a pragmatic approach of what (and when) to do with the next release.

One year coding Pomm2

The second version of Pomm sits on 4 years of experience with the projection to entity design but Pomm 1.x was a monolith. The goal of the new version was to be more robust, far more flexible and as fast as it could. We did rely on three tools to ensure this:

Test driven development

It may sound obvious an open source project uses a unit test suite today but take it further: Pomm2 could not have been achieved without TDD. The converter system, the hydration process are complex beasts lying deep in the PHP code far from the end developer’s consciousness. They must just work as expected or it would turn Pomm into a unreliable piece of useless code. Atoum did really helped us because it comes with a built-in mock system and is easy to use. Pomm2 is tracked on Travis-CI for every commit.

Quality measured

The measure of quality showed Pomm 1.x had come to a limit so Pomm2 has been build using scrutinizer continuously. This tool gives very relevant indicators about the evolution of the development and it is really rewarding in terms of flexibility. The provided graphics are really helpful and solving reported problems does make the code better.

Performance in mind

Sensio did open their blockfire.io beta to us at the early stages of Pomm’s developments. We instantly took advantage of this extraordinary tool. Pomm has been tested in the most weird ways using blackfire: with tables having more than one hundred columns, fetching million rows, exporting them to JSON etc. The ability to look at performances differences between several revisions of the code is a killer feature. We could track memory consumption, CPU and I/O usage, Pomm would probably be 100 times slower without it. It would be sad to invest in such a nice database engine and use it with a slow access layer.

Open source

Yes, Pomm is open source, supported by open source benefactors like github, scrutinizer, blackfire.io, Travis-CI and would not even exist without Postgresql nor PHP (not to talk about GNU/Linux, Git, Vim etc.).

We have been coding and promoting Pomm for 5 years now. We would like to thank the PHP community and the related companies. They always opened their doors for us to present Pomm and Postgresql. Thank you. Also, Pomm is a community work with contributions from lot of nice developers. Some of them fixed typos, other did report bugs, some submitted patches … thank you all for helping in making Pomm the best tool to use Postgresql in PHP.

Migrating from Pomm 1.x

Although Pomm 1 & 2 share the exact same philosophy, the latest is an almost complete rewrite of the first to cut off with its limitations. Migrating a project from Pomm 1.x to Pomm2 maybe possible depending on project size however this will require work. There unfortunately are no automatic recipe to migrate from using Pomm 1.x to Pomm2.