Backbone is a barebones data model implemented in object-oriented PHP that provides several classes to easily work with a many-to-many hierarchical database model; all database queries written in SQL and using PDO prepared statements and memcached support is available. It uses only four tables and one main, easily extensible PHP class to allow you to develop and alter your app without having to change your database schema.
Everything is an object and is stored as a row in objects; each object has a type and a name. For example, an object can be of type User and with value Anastas. Objects can have attributes; a User object might have an attribute of type Permissions with value 0755, stored in object_attributes.
Objects are related by associations, stored in associations. Associations are hierarchical, are made between objects, and can have a type. A Fruits object might be related to the Apple object by an association type of Member, with Fruits being the parents and Apple being the child.
Associations can have attributes, which are stored in association_attributes. A message between two User objects might be stored as an association of type Message with parent the sender and child the recepient, and may have association attributes of type Subject and Body that contain the message subject and body, respectively.
base just has a number of basic functions to be used by the other objects, such as setting memcached keys (if memcached support has been enabled), logging errors to a file, and accessing session variables in such a way that there will not be a PHP NOTICE if they haven't been set yet.
dbpdo extends base and is where the database connection/querying happens, including optionally checking memcached for a particular key and using the corresponding value instead of querying the database.
object is always constructed with a dbpdo object passed to it. If passed the $id constructor parameter, it will load information from row $id in objects for immediate use. It is suggested that you have a single dbpdo object and pass it to every object that is created so that they share the same connection. Look through the methods in the object class, which include getting the current object's parents or children, filtering those by type, adding and removing parents and children, updating attributes, and so on.
Instead of using functions like mysql_real_escape_string() to manually sanitize user data and hoping no queries were forgotten, Backbone uses the PDO driver and prepared statements to eliminate any worries about SQL injection.
Memcached integration is built into the dbpdo class and just needs to be enabled in the config file. Just make sure to keep track of your memcached keys and easily attain a significant speed increase.
The use of the PDO driver allows you to easily switch between MySQL and PostgreSQL, for example, by simply changing a parameter in the config file. Standard SQL is used, so such migrations should be painless.
The main class, object.class.php, comes with standard methods for creating, altering, and removing objects, associations, and attributes. Just extend the class to take advantage of this abstraction.