RDB: Redbean PHP Wrapper

Custom property getters on beans, better error reporting, sql-verbs as an API. Additional convenienence functions.

Getting Started

Install: composer require taeluf/rdb 0.2.* or v0.2.x-dev or {"require":{"taeluf/rdb": "0.2.*"}}

We use \RDB:: instead of \R::. See Redbean docs for things not covered here.

1. Setup your connection

@import(GettingStarted.setupDb)

2. Write Some Data

@import(GettingStarted.writeData)

3. Create a Model (if you need)

Custom Redbean Models let you add functionality to redbean. RDB simplifies some things.

@import(GettingStarted.Model)

& Use that model:

@import(GettingStarted.usingModel)

Other Stuff

  • $bean->props() to get all properties (just the ones from the database)
  • $bean->export() adds _type to the exported array.
    • (untested) Call $bean->import($exported) and your exported array will load into the database, thanks to the _type addition
  • Table names (types) are made lower-case, and non alpha non-underscore characters are removed, so you don't have to be so careful about the type you pass into RDB::find()