Get The Code

PDO MySQL

The Pdo class is a wraper class for the built-in \PDO class. Valhalla's Pdo class must be extended by another class which should define the database name and connection information. This ensures that you do not need to pass in the database configuration in every service where you use your class. Extending Valhalla's Pdo class also allows you to to make your DAO into a singleton if it is possible in your project (unfortunately the Pdo class cannot be a singleton by itself without imposing too many restrictions on the usability).