Rocks (PHP)
Encyclopedia
The Rocks Library contains a database independent object-relational mapper (ORM) for PHP 5.1 plus, allowing easy access to all types of database.
However the Rocks Framework also includes other functionality such as a templated system for producing web pages, which encaspulates general web development problems.
the development team mainly consists of volunteers. Currently this framework is in alpha testing.
with one class corresponding to one table in the database however it is slightly different in that each class maps dynamically to the table.
Although as of version 0.02 multiple classes can now be returned using the RocksDBOArray class.
This selects a user with the username value of John. Smith if more than one record is returned an exception will be thrown. A record can be saved like so:
Due to the dynamic nature of Rocks you can specify as many fields as you like in a class. For instance in the example above a field called age could also be provided but unless there is a corresponding field in the database table this will not be saved or updated from data in the database.
One of the best features about this library is the lack of configuration. All the library needs to know is the database connection parameters it is connecting to and it will configure itself.
However the Rocks Framework also includes other functionality such as a templated system for producing web pages, which encaspulates general web development problems.
Development
This is an open source project hosted on SourceForgeSourceForge
SourceForge Enterprise Edition is a collaborative revision control and software development management system. It provides a front-end to a range of software development lifecycle services and integrates with a number of free software / open source software applications .While originally itself...
the development team mainly consists of volunteers. Currently this framework is in alpha testing.
Usage demonstration
This is similar to the active record patternActive record pattern
In software engineering, the active record pattern is an architectural pattern found in software that stores its data in relational databases. It was named by Martin Fowler in his 2003 book Patterns of Enterprise Application Architecture...
with one class corresponding to one table in the database however it is slightly different in that each class maps dynamically to the table.
Although as of version 0.02 multiple classes can now be returned using the RocksDBOArray class.
$user = new RocksDBO("user");
$user->username = "John.Smith";
$user->Select;
This selects a user with the username value of John. Smith if more than one record is returned an exception will be thrown. A record can be saved like so:
$user = new RocksDBO("user");
$user->firstname = "John";
$user->surname = "Smith";
$user->Save;
Due to the dynamic nature of Rocks you can specify as many fields as you like in a class. For instance in the example above a field called age could also be provided but unless there is a corresponding field in the database table this will not be saved or updated from data in the database.
One of the best features about this library is the lack of configuration. All the library needs to know is the database connection parameters it is connecting to and it will configure itself.