Scaffold4PHP 1.0 released

After 2 weeks of on and off work on this application, scaffold4php, i finally just sat down to crank it out today. Yes yes i know its small but none the less i wanted to complete it and just put it out there. I hope people use it.

What does it do? In a nutshell it creates object representations of tables in a database and also creates the basic CRUD methods for these tables. It creates the foundation of any dynamic application in seconds rather than hours.

Example, Say we have a database “test”. In this database we have 3 tables. “table1”, “table2”, and “table3”. After running scaffold4php.php I will have 3 objects (classes).
“Table1.class.php”, “Table2.class.php”, “Table3.class.php”.
Inside these objects there should be 5 methods and 2 global variables which are created for me in seconds.

Methods:
1. add() – adds a new entry to the database.
2. remove() – removes a record from the db.
3. update() – updates a specific column for a record.
4. getAll() – returns all the records in the db.
5. getObject() – returns a specific record as an object.

Also, I added comments so I hope people read the dynamically created comments for each method.

So how does it work? Well I created a config file in xml that the user can use to set the database connection information. Then i used the internal PHP library DomDocument instead of SimpleXML to parse out the xml data from the xml file (no i wont go into why i chose DomDocument rather than SimpleXML 🙂 ). After fetching the data i just used PEAR::DB libraries to fetch the table information and sent that array to ClassFactory class which creates the php files and the methods using a template i created for each method. Yay..{takes deep breath}!

As far as updates, I would like to add more features to the xml such as allowing the developer to place restrictions on which tables to create objects for, setting primary key indicators so creation of the objects can be more detailed and maybe change out the Armando style commenting to something more standard like PHPDoc annotations. Adding Smarty views to these objects is also a possibility.

Enjoy, Scaffold4PHP version 1.0
http://sourceforge.net/projects/scaffold4php/

Armando Padilla

Add a Comment

Your email address will not be published. Required fields are marked *