We make elephants to talk
Pomm is a lightweight, fast, efficient and powerful PHP Object Model Manager for the Postgresql relational database. Pomm is not an ORM, it is more like an object hydrator above PDO implementing the identity map design pattern and proposing a type converter in addition to other convenient features.
Because Pg does offer a lot of nice features one of them being the ability to deal with tables as objects.
What it just needs is a nice hydrator with a convenient converter system to take advantage of all its features from PHP. This makes developers able to shape their data as they want to simplify the PHP layer. Pomm will never be an ORM and is not planned to work with another database.
Once you have designed your database, Pomm's tools can generate PHP model classes for you by inspecting tables and views. It checks the schema where your database objects are stored so generated classes use different PHP namespaces, there will not be naming collision anymore !
Queries return Collections which are iterators on results. Objects are hydrated on demand for minimal memory consumption and data are converted from/to Postgresql. Boolean in Pg are boolean in PHP, arrays in Pg are arrays in PHP, geometric types are converted into geometric PHP objects. Of course this is extendible and custom database types can be converted into custom PHP classes. Almost all standard and geometric types are supported plus HStore and ltree extensions.
Of course 80% of the queries of a web applications are like «SELECT ... FROM ... WHERE ... ». So there is a method for that. You can configure what you do want in the select fields in case you would like to add your classes extra properties. For the more complicated queries, SQL is the way to go. You can use all the awesome operators, full text search, window functions, recursive queries, (insert your preferred feature here).
When retrieving data from the database trough a Collection object, it is possible to register PHP anonymous functions as filters before objects are hydrated.
All queries are also made in a Filter Chain design pattern. You can add your own filters to place code before and/or after each query.
Sometimes, you want to create a WHERE clause dynamically. Pomm proposes a
Where class to let you
OR your conditions passing the values as argument each time for escaping. There is even a
WhereIn method with an array of values as parameter.
All queries are prepared, the values you give as argument are automatically escaped by the server. Furthermore, the converter system ensures there is no type enforcing.
To be sure everything is fine, you can register the
LoggerFilter to your connection so you will keep track of every query with statistics like the time it took, the number of results returned etc.
My name is Grégoire HUBERT, I use Linux, PHP and Postgresql since the 20th century and I have started working on Pomm 3 years ago which was named PgLook at the time (you can still use it for your symfony 1.x projects although it is not maintained anymore). Pomm has evolved based on my projects and professional needs. It is released under the MIT/X11 licence so feel free to use, distribute or modify it. You can send me an email at hubert dot greg at gmail dot com or follow me on twitter @chanmix51. You can also follow Pomm's activity on twitter.