Use RedBean ORM with Silex micro-framework

As a PHP developer, I love using RedBean as an ORM and Silex as a micro-framework. But I have to admit the fact the former comes as a static class isn't quite handy sometimes.

I was looking for a solution to make the two of these communicate with each other in a better way. Some effort has already been put into it, but the linked package doesn't help with the main issue I described above, so I decided to roll out my own.

Here comes a RedBean service provider for Silex, available and following the PSR-2 and PSR-4 standards. It's dead simple, and mainly serves one purpose : make RedBean available as an instance through Silex's service containing capabilities (which should help with mocking while writing unit tests). Using it thus allows you to write code like the following :

$book = $app['redbean']->dispense('book');
$book->title = 'PHP for dummies';
$app['redbean']->store($book);

As usual, I strongly encourage interested people to contribute to the project via GitHub !

As a side note, if you ever wanted to use my Environ along with Silex, I wrote a as well.