building blocks for developers
dbphp - an introduction
dbphp 0.2 has just been released - 2009/09/02
new functionality includes ability to search table from parameters set on object using searchOnSelf() and better handling of boolean operators download here
updated dbphp tools
- Object relational mapping is the process of creating a structural relationship between the classes/data objects used in the logic layer and the database itself
- One of the most successfully implemented exampled of an object relational/persistence frame work in the world of open source software is Seam with Hibernate. Seam is a framework for Java that allows one to run a generation script against a database and return an entire class frame work mirroring the structure of the database.
- It allows for information to be directly loaded from the database into memory, view/altered/removed, and these changes saved without the user ever having to interact directly with the database through structured query language.
- dbPHP is not designed to be commercial - if you want a hardcore resilient server with tons of functionality then you would never even consider PHP. what dbPHP aims to do is speed up the development times of quick and dirty PHP.
- PHP allows users to develop code in incredibly shoddy ways with no regard for performance or re-usability and dbPHP tries to steer the developer towards a more structured object-oriented style of development.
- Existing Frameworks
- Zend Framework
- WACT
- Prado
- ZooP Framework
- eZ Components
- CodeIgniter
- CakePHP*
- Symfony Project*
- Seagull Framework*
- PHP on TRAX*
- My research has lead me to believe that only 4 of the existing main frameworks have object relational mapping capability *.
- Object Relational Mapping
- The importance of object relational mapping in scalable designs is clear. Maintaining a cross-platform relationship between data structures underpins many concepts which form the future of the internet - using an ORM Java example, a table can be taken from a database, loaded into memory and then directly output in XML - allowing for easy transfer of information retaining all of the semantic meaning using an open and widely available transport standard.
- Lightweight.
- The lightweight element of dbPHP is the key to its strength. PHP is free, it runs on cheap nasty hosting and it can provide a reasonable degree of functionality in relation the the manipulation and display of data for the web. dbPHP requires no installation other than being present in a directory. It is a series of classes that can be extended allowing child classes to map their internal structure to database objects and inheriting a number of useful SQL commands such as update, delete, findAll.
- This lightweight element is the prime motivator behind the project - no big install is necessary and existing code can be easily modified with the addtional functionality with the addition of a simple mapping constructor

- PHP Limitations
- PHP has severe memory and performance limitations when it comes to handling large amounts of data or highly recursive tasks (default time out is set to 30 secs). It also has no ability to run threads and the only time it ever bothers to execute anything is if someone or something requests a page be served up. Global variables are seriously dodgy as you never really know what has access to them meaning that whenever you are requesting something from memory you have no way of knowing who set it, what's in it or if it will change.
- PHP will quite happily work in a similar way to a well laid out java class model with private variables and get/set functions if one spends the time to do this.
- Creative context.
- When you want to make a project on the web, unless you love code, you don't really want to be spending half your time reinventing the wheel and rewriting code for boring banal stuff like update databases or other such stuff. Taking this to the extreme you can make all your projects in word press and totally abstract yourself from the process - if however your project involves some low-level elements, you're doing something clever with data, you want to incorporate a piece of flash that requires the storage of persisted data or you want to create a custom photo gallery of your own design - you probably want to focus on your own project and program logic. What dbphp does is allow you to treat your database and table as another area of memory and store and retrieve without extra hassle.
- framework comparison chart
- other ORL solutions