Software:Rocks (PHP)

From HandWiki
Rocks
Stable release
0.2.1 / May 29, 2009 (2009-05-29)
Written inPHP
Operating systemCross-platform
TypeObject-relational mapping and web development framework
LicenseGNU General Public License
Websitewww.php-rocks.com

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.

Development

This is an open source project hosted on SourceForge the development team mainly consists of volunteers. Currently this framework is in alpha testing.

Usage demonstration

This is similar to the active record pattern 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 features this library supports 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.

External links