Gentle-DB
A simple web database written in PHP,
licensed under the GPL.
Goal
The goal is to allow anyone to create a simple database for the
web. No need to install and manage a database server, no need to
code an interface. The web interface should build itself
automatically from a description of the schema.
Design
schema -> web interface -> dbm
Currently, the schema is a text file. It is a 2D array that
describes tables and fields.
The web interface is written in PHP for portability.
The database is any one of the dbm hash tables, such as gdbm.
Examples
Perhaps you want to keep track of your books.
Your schema file might look as follows:
$schema = array(
"books" => array(
"ISBN" => "",
"title" => "",
"author" => "",
"publisher" => "",
"purchase_date" => "",
"purchase_price" => "",
"notes" => ""
)
);
Here is the result
Now, lets say that you want to create a table for publishers.
Edit the schema to add a new table called publishers, and have the books
table point to it.
$schema = array(
"books" => array(
"ISBN" => "",
"title" => "",
"author" => "",
"publisher" => "publishers",
"purchase_date" => "",
"purchase_price" => "",
"notes" => ""
),
"publishers" => array(
"name" => ""
)
);
Here is the result
If you loan these books often, you might want to keep track of that.
$schema = array(
"books" => array(
"ISBN" => "",
"title" => "",
"author" => "",
"publisher" => "publishers",
"purchase_date" => "",
"purchase_price" => "",
"notes" => ""
),
"publishers" => array(
"name" => ""
),
"friends" => array(
"name" => "",
"phone" => ""
),
"loans" => array(
"friend" => "friends",
"book" => "books",
"date" => ""
)
);
Here is the result
Notes
Don't use spaces in field names. Renaming fields just creates a new field and
ignores the old field, so don't try it yet. The first field of any table will
be used in drop-down lists, so make it unique.
Get the Code
gentle-db.tar