gluefish.net

SiPPF

Simple PHP5 Persistancy Framework

SiPPF is an open source library to persist entities to your database. It does this in a very flexible manner.

This project is in a pre-alpha stage!

Persistency Framework

In an application that uses a database it is very common that you have lots of SQL-queries, that only differ in very small parts, and boring to write. By using a persistency framework you can avoid having to write most of these queries and save a lot of time. Once you discover the power of a persistency framework such as Hibernate, you'll probably never want to work again without such a library.

PHP 5

After having used Hibernate and NHibernate in some projects, i wanted to have a similar framework for PHP. While there are several solutions, i didn't really found what i was looking for. Either they were just too simple, they required you to adapt some design, like inheriting from a specific class, or they were very heavy, such as Propel.

I wanted an easy to use and small framework, which doesn't require you to adapt special design patterns. These are the key feature i keep in mind for SiPPF.

An example

After configuration, which is rather straigthforward and comparable to Hibernate configuration, storing and loading an entity from your database is as simple as:

  1. //get the sippf instance and connect
  2. $sippf = SiPPF_SiPPF::getInstance();
  3. $sippf->connect("dbbms://user:pwd@host/dbname");
  4.  
  5. //create a new person, which will be stored in the database
  6. $person = new Person("name", 22);
  7.  
  8. //store the entity
  9. $sippf->persistObject($person);
  10.  
  11. //load the person with ID 1
  12. $anotherPerson = $sippf->loadObject(1, 'Person');