https://github.com/ivoba/redbean-service-provider
A RedBean ORM ServiceProvider for Silex.
https://github.com/ivoba/redbean-service-provider
redbean silex
Last synced: 10 months ago
JSON representation
A RedBean ORM ServiceProvider for Silex.
- Host: GitHub
- URL: https://github.com/ivoba/redbean-service-provider
- Owner: ivoba
- License: mit
- Created: 2013-11-06T18:04:02.000Z (over 12 years ago)
- Default Branch: master
- Last Pushed: 2017-02-24T08:59:56.000Z (over 9 years ago)
- Last Synced: 2024-11-18T09:43:39.964Z (over 1 year ago)
- Topics: redbean, silex
- Language: PHP
- Size: 8.79 KB
- Stars: 8
- Watchers: 4
- Forks: 4
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
- License: LICENSE
Awesome Lists containing this project
README
# RedBeanServiceProvider
A [RedBean ORM](http://redbeanphp.com) ServiceProvider for [Silex](http://silex.sensiolabs.org).
[](https://travis-ci.org/ivoba/redbean-service-provider)
## Usage
- Define a db.options array in ```$app``` with *dsn*, *user*, *password* and *frozen* entries.
Or just pass the array while registering. see below.
- Register the Service:
```$app->register(new Ivoba\Silex\RedBeanServiceProvider(), array('db.options' => array(
'dsn' => 'sqlite:/tmp/db.sqlite'
)));```
- Init RedBean with calling ```$app['db'];```.
This you can do in your controller or more general.
Then you can access your configured Facade R.
use RedBean_Facade as R;
...
$app['db'];
...
$e = R::findAll('table',' ORDER BY date DESC LIMIT 2');
Happy tight coupling ;)