Zend Integration

From RedBean

Jump to: navigation, search

Zend Integration

Integrating RedBean in the Zend Framework is easy. Just follow these steps.

1. Copy the Library

First, copy the RedBean folder to your Zend Library folder so that you can access RedBean using:

library/RedBean You can also create a symlink if you like.

2. Configure

Now open your Zend bootstrap file and add:

public function run() {
$loader = Zend_Loader_Autoloader::getInstance()->registerNamespace('RedBean_');
require_once( APPLICATION_PATH . "/../library/RedBean/redbean.inc.php");
$tools = RedBean_Setup::kickstartDev( "mysql:host=localhost;dbname=timereg", "root" );
Zend_Registry::set("tools", $tools);
Zend_Registry::set("db", $tools->getDatabaseAdapter());
Zend_Registry::set("redbean", $tools->getRedBean());
parent::run();
}


Your RedBean Toolbox can be retrieved using:

$toolbox = Zend_Registry::get("tools");
Personal tools