A light but powerful flat file database package.
PHP 5 and later comes with the SQLite extensions already enabled. If available, SQLite will usually be a massively superior alternative to a flat file database. PLEASE PLEASE, do yourselves and your data a favour and use SQLite instead!
Seriously, use SQLite. You shouldn't have got this far down the page. Why are you still here? Please go away, unless you really, really cannot use SQLite.
Still here? Well, you have been warned.
This package is comprised of 2 smallish PHP files, fully documented. It is very easy to use, and with the example based tutorial in the documentation you should be up and running in a couple of minutes.
The package is built to be very flexible and extensible, while providing the majority of built-in functionality that would be commonly used. For example, WHERE clause functionality is provided by a family of WhereClause classes. This means first that the selectWhere(), updateSetWhere() and deleteWhere() functions are all equally powerful without having any duplicate code, and secondly that you can provide your own WhereClause objects (that implement the WhereClause interface), if the builtin functionality is not enough. Also, while there are 3 builtin comparison methods (used in a number of places), they can in each instance be replaced with user defined functions in case you need to do things like case insensitve sorting/comparing.
It is also built to avoid arbitrary limitations (while maintaining simple syntax for the common cases). For example, you can have arbitarily complex WHERE clause expressions (by combining WhereClause objects using things like AndWhereClause), and can specifiy ORDER BY with any number of fields.
The format of the database files is tab delimited text files, and no database schemas, indexes for optimisation or any other files are used. (Note that the format means you cannot store tabs or newline characters directly in a table -- you will have to escape these yourself before storing them).
The package is run against a set of tests which are now fairly comprehensive, so you can have confidence in the quality.
The package provides no support for relational features like joins. It provides only the most simplistic attempts to handle concurrency (simple file locks using PHPs flock, only when writing), which obviously still leaves plenty of room for race conditions or dead locks. Flatfile makes no attempt to be fast by using indexing or other methods, or to ensure data integrity, or that data has been written securely to disk etc. These features are omitted by design, since otherwise you will simply end up with an ad hoc, informally-specified, bug-ridden, slow implementation of half of an RDMS :-) If you need those featues, you need something like PostgreSQL, or for less demanding situations SQLite may suffice.
MIT (which means in short that it is open source and free of charge for any use, and without ANY warranty).
Other resources on lukeplant.me.uk | Contact author: L.Plant.98 (at) cantab.net