P-dd

P-dd is a PHP library for creating dynamic relational database documentation, in a number of forms, for an arbitrary database.

Sunday, December 31, 2006

P-dd 0.1 finally released

Hi all,

Welcome to the world of P-dd - The PHP Database Documentor.

So what is it?

Put simply, it's a library of PHP classes that allow for the easy generation of documentation from a set of database sources.

Put even more simply, it's yet another open source project...

What is the project aim?

  • To make it easy to dynamically create documentation on the structure of relational database based systems regardless of the number of, flavour and capabilities of those systems or the type of documentation required


How does the architecture of the library allow for that?

The library is split into three main components:

  • The Datasources

  • The Database model

  • The Renderers



The Datasources are those components concerned with the collection of raw data from the actual datasources. For example, and OracleDatasource class exists that is aware of how to interrogate an Oracle database for its structure. An XmlDatasource exists that can interpret an XML document that contains a relational database specification. All datasources conform to the same interface (currently described by the TestDatasource) making them interchangeable.

The Database Model is a class based representation of the Table / Column / Key structures that are ubiquitous within the relational database model. A factory exists that can take any of the datasources and produce a complete database model.

The Renderers are capable of taking a formed Database Model and rendering it in that renderer's chosen form.

The structure is such that it is easy to add new datasources, as long as they support the minimum structure required of the model. It is also simple to produce new renderers, as they require only knowledge of the generic database model, and no knowledge of the sources themselves.

So what's available in this version?


  • A database model that consists of:

    • Tables

    • Columns

    • Primary Keys

    • Foreign Keys



  • The database model can be created from the following sources:

    • Oracle

    • XML File



  • The model can be rendered into the following formats:




There are also lots of other little goodies in there such as datasource independant filters, a datasource caching system that limits the round trips to the database and a plethora of examples showing how components can be used as well as a simple Oracle database viewer application to show off what can be possible with just a small amount of work.

And what's the plan for the future

The idea is that, over time, database sources will be added that will allow for the collection of meta-data from all the major database players (Oracle / MySql / Postgres / etc) and produce documentation in most of the popular forms (HTML / XML / RTF / PDF / etc) including ER diagrams.

It is also recognised that in the future it is desirable to take the library into a more analysis role. For example - inferring foreign keys that are not explicitly stated, either by examining the table structures or the data within those tables. Though that is very much a longer term plan.

OK, so where is it?

The source code can be found on Google Code here: http://code.google.com/p/p-dd/ the current release tag being P-dd-0-1-0
More information of the plans for the project can be found on Backpack here: http://bobalicious.backpackit.com/page/800325

So what now?
Well, I hope that some of you people will pick it up and start providing feedback... please do so. But regardless, this remains a little bit of a vanity project anyway so I'm going to keep going with it and see where it takes me even if no-one uses it. Isn't that the life of most open source projects anyway ;-)


Technorati Tags: , , , , , , , , , , , , ,

Labels: ,