A ZF2 module to provide RedbeanPHP ORM
PHP
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
config
src/Richardjh/RjhRedbean
tests
.gitignore
Module.php
README.md
autoload_classmap.php
composer.json

README.md

RjhRedbean

RedbeanPHP ORM module for Zend Framework 2

Installation

Install using composer, for example

composer require richardjh/rjhredbean:dev-master 

and configure as a ZF2 module in config/application.config.php

'modules' => array(
    'Application',
    'richardjh\rjhredbean',
),

Configuration

Copy vendor/richardjh/rjhredbean/config/autoload/local.php.dist to config/autoload/rjhredbean.local.php and enter the database settings. You can find more information about this at http://www.redbeanphp.com/manual/compatible

Usage

To get a configured instance of Redbean to use in your controller, do it like this:

public function indexAction()
{
	$rb = $this->getServiceLocator()->get('RjhRedbean');
	$t = $rb->dispense("foo1");
	$t->when = time();
	$rb->store($t);
}

Alternatively to get a configured instance of Redbean into a Service or Model simple implement the RedbeanAwareInterface provided and and the RedbeanAwareInitializer will inject the Redbean instance for you.

Using newer versions of Redbean (>v3.5.1)

Versions of RedbeanPHP newer that v3.5.1 aren't published on packagist and therefore RjhRedbean cannot load them directly. There is a simple solution by editing the composer.json file in your own ZF2 project. Please read http://richardjh.org/blog/use-latest-redbean-rjhredbean.php for details on how to do this.