With phpYouDo (PYD), the development of Database Driven WebApps (DDWA) with PHP gets standardized, clearly arranged and last but not least: mainly outsourced to the client.

Build Status

Intro slideshow (move along with cursor-keys)


DDWA's in general consist of these parts: HTML-Templates, PHP-Scripts and JavaScripts. Most often, these parts are tightly woven into each other, which makes it tricky for the designer to edit the HTML. Additionally, the PHP-Programmer has a hard time extracting SQL-queries for specific inspections.

phpYouDo tries to solve these problems by separating the PHP-Scripts from the SQL-Queries and the HTML-Templates. SQL-Queries are outsourced to configuration files and HTML-Templates are combined with JavaScript to display the selected records:

An application in phpYouDo consists of one or more reports. Reports in turn consists of one or more database queries. Each query can get visualized with an individual HTML or PHP template.


When to use phpYouDo?


Server: PHP with PDO

Client: A JavaScript enabled browser


Simple copy the index.php to any place you want on your webserver and start app-development!


Q: Can PYD handle multiple databases in one application?

A: Yes, see the examples.

Q: What sorts of databases PYD can handle?

A: Only relational ones. PYD uses PHP Data Objects to access databases.

Q: The examples use SQLite databases only. How to use MySQL?

A: Example db.ini.php for MySQL:


Q: How can SQL statements be debugged?

A: The execution of each section inside a report can be logged by adding the key log with a value of 1 or 2: 1 means a full log, while 2 logs only the time spent on the execution of the query. The log-entries are published in your PHP error-logfile.

Example report:


; Only gets executed when the lorem parameter is set:
sql="SELECT * FROM lipsum WHERE lorem=:lorem*"


Example log-entries:

[26-May-2014 14:02:42 UTC] PYD example_01_intro\get\get_required GET params: application,report,lorem
[26-May-2014 14:02:42 UTC] PYD example_01_intro\get\get_required POST params:
[26-May-2014 14:02:42 UTC] PYD example_01_intro\get\get_required SQL params: get_lorem
[26-May-2014 14:02:42 UTC] PYD example_01_intro\get\get_required SQL param values: 3
[26-May-2014 14:02:42 UTC] PYD example_01_intro\get\get_required Obligatory params: get_lorem
[26-May-2014 14:02:42 UTC] PYD example_01_intro\get\get_required Seconds needed for binding params and executing query: 0.00011682510375977

Best practices

Debugging SQL-statements with MySQL

Make use of the General Query Log.

Alternatives or additions to phpYouDo

Glossary and abbreviations

PYD: phpYouDo

DDWA: Database Driven Webapp

Application: A set of reports

Report: A set of queries

Subreport: A report within a report

Query: An SQL statement


This work is licensed under the Creative Commons Attribution 4.0 International License. To view a copy of this license, visit http://creativecommons.org/licenses/by/4.0/.