Using the DAO Generator for PHP and MySQL

data access object (DAO) provides an abstract interface to a database—giving developers access to common database operations without them having to know the database schema details—essentially, data access object separate the business logic and data tiers of an application. This separation is important, because these two important application tiers should know almost nothing about each other, and you can expect both to evolve frequently and independently. With DAO in place, changing business logic can use the same DAO interface, while changes to persistence logic does not affect DAO clients—as long as the interface remains correctly implemented.

The DAO generator for PHP and MySQL automates the process of creating DAO classes for MySQL databases. In this article, you’ll see how to:

  • Install the DAO generator for PHP and MySQL
  • Generate a DAO artifact using a given database (bookstore)
  • Create an application using DAO generator tool and its factory classes
  • Create a transaction spanning multiple SQL operations
  • Add a custom DAO function to a generated class

DAO generator for PHP and MySQL

A DAO generator creates classes in a specific language, usually for a specific target database. You use the DAO generator for PHP and MySQL to generate PHP classes that query and update MySQL databases using the DAO design pattern. The tool is relatively simple to install and use, but to use it effectively, you need to know a little about the DAO mechanism.

You can download the DAO generator for PHP and MySQL here. To install it, follow these steps:

  1. Download the archive.
  2. Unzip the archive in the htdocs directory.
  3. Setup a connection to an existing database by specifying the database properties in the templates/class/dao/sql/ConnectionProperty.class.php file.
  4. Run the generate.php script.
  5. The tool places generated classes in the newly created folder named generated.
  6. Source:

Published by

Bhavya Web Technologies

We are team of young, energetic and dynamic members, focused on providing high quality website designing, website development and Internet Marketing services. With a team of such Bhavya member we always try and deliver high quality of project, exceeding client’s expectation.