PHPackages                             ycms/redbean - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Database &amp; ORM](/categories/database)
4. /
5. ycms/redbean

ActiveLibrary[Database &amp; ORM](/categories/database)

ycms/redbean
============

A Laravel 4 implementation of Redbean 4.

027PHP

Since Jul 17Pushed 10y ago1 watchersCompare

[ Source](https://github.com/ycms/redbean)[ Packagist](https://packagist.org/packages/ycms/redbean)[ RSS](/packages/ycms-redbean/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

redbean4laravel4
================

[](#redbean4laravel4)

### A Laravel 4 package for RedBeanPHP ORM 4.1

[](#a-laravel-4-package-for-redbeanphp-orm-41)

This is a Laravel 4 package to allow the use of [Redbean PHP ORM](http://redbeanphp.com), version 4.1.

### How to install

[](#how-to-install)

Add

```
"mamift/redbean4-laravel4":"dev-master"

```

to your composer.json file. Then add this line:

```
'Mamift\Redbean4Laravel4\Redbean4Laravel4ServiceProvider'

```

to your Laravel service provider's array in app.php inside the config/ folder, so RedBeanPHP is setup using Laravel's database settings (inside database.php).

Because RedBeanPHP also includes it's own facade class ("R"), there is no need to add anything into the alias array.

### Usage

[](#usage)

Read [RedBeanPHP's documentation](http://redbeanphp.com/crud) for a complete overview of what you can do with RedBean. Because this package includes the full rb.php file unmodified, every programmable interface listed on RedBean's API documentation pages should be usable.

An example:

```
$user = R::dispense('user');
$user['description'] = "Lorem ipsum dolor sit amet, consectetur" + adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.";
$user->username = "mamift";
$user->gender = R::enum('gender:male');
R::store($user);

```

### Why use RedBean with Laravel?

[](#why-use-redbean-with-laravel)

RedBean is a very flexible way to flesh-out a database without having to worry about foreign-key relations or how your table is structured; it is 'schema-less' in a sense, in that it will build the appropriate database and table structures without you having to worry about the details. For this reason, it is a neat way to rapidly prototype the backend for a Laravel app. You could use RedBean as a lazy substitute for Laravel's Schema Builder and forego seeding in a separate step for example, as you can define the schema and seed the table with values in the one migration step.

In the above example where the following line is:

```
$user->gender = R::enum('gender:male');

```

RedBean will create a separate table, 'gender', and include an appropriate primary key (an **AUTO\_INCREMENTING 'ID'** column when you're using MySQL). Whenever you use **R::enum()** again, (like **R::enum('gender:female')** for instance), then RedBean will add another 'female' record inside the 'gender' table.

Note how it doesn't use the built-in \[ENUM\] data type as a column type; this enables you to define another bean (table) which can use the same set of values.

RedBean will also determine the appropriate data type depending on the values of the properties of your beans. In the above example, **$user\['description'\]** is stored as TEXT and **$user-&gt;username** is stored as VARCHAR(255).

When reverting a Laravel migration, you may need to also use Schema builder methods such as **Schema::drop('user')** or **Schema::drop('gender')**, as RedBean does not provide a way to delete the table schema. Instead it allows you to erase all instances of a bean (equivalent to deleting all rows inside a table) using **R::wipe('user')**.

However, RedBean does allow you to destroy all tables altogether in a single step using **R::nuke()**, but this will destroy everything inside the database, including the *migrations* table.

### A note on how this package exposes RedBean in Laravel

[](#a-note-on-how-this-package-exposes-redbean-in-laravel)

Due to the way the author of RedBean uses PHP namespaces (it doesn't appear to be PSR-4 compliant), he does not provide his own composer.json and as such, the rb.php file (the file that RedBeanPHP is commonly distributed in) does not appear to be autoloadable by Laravel.

What this package does is load rb.php for each request. Under the "autoload" JSON object inside composer.json, rb.php is specified as part of the "files" array:

```
{
    "autoload": {
	    "files": [
	        "src/Mamift/Redbean4Laravel4/rb.php"
	    ]
	}
}

```

A quote from the [Composer documentation](https://getcomposer.org/doc/04-schema.md#files) says:

> If you want to require certain files explicitly on every request then you can use the 'files' autoloading mechanism. This is useful if your package includes PHP functions that cannot be autoloaded by PHP.

Due to rb.php being loaded on each request, there may be a slight performance penalty incurred.

###  Health Score

21

—

LowBetter than 18% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 80% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://www.gravatar.com/avatar/a7a3e86f4c5b8711afc3fa0c0cc06cc93ea32bd4a6056085ca67419d6715e378?d=identicon)[ycms](/maintainers/ycms)

---

Top Contributors

[![mamift](https://avatars.githubusercontent.com/u/2508444?v=4)](https://github.com/mamift "mamift (8 commits)")[![GameCHN](https://avatars.githubusercontent.com/u/13175811?v=4)](https://github.com/GameCHN "GameCHN (2 commits)")

### Embed Badge

![Health badge](/badges/ycms-redbean/health.svg)

```
[![Health](https://phpackages.com/badges/ycms-redbean/health.svg)](https://phpackages.com/packages/ycms-redbean)
```

###  Alternatives

[doctrine/orm

Object-Relational-Mapper for PHP

10.2k285.3M6.2k](/packages/doctrine-orm)[jdorn/sql-formatter

a PHP SQL highlighting library

3.9k115.1M102](/packages/jdorn-sql-formatter)[illuminate/database

The Illuminate Database package.

2.8k52.4M9.4k](/packages/illuminate-database)[ramsey/uuid-doctrine

Use ramsey/uuid as a Doctrine field type.

90440.3M211](/packages/ramsey-uuid-doctrine)[reliese/laravel

Reliese Components for Laravel Framework code generation.

1.7k3.4M16](/packages/reliese-laravel)[wildside/userstamps

Laravel Userstamps provides an Eloquent trait which automatically maintains `created\_by` and `updated\_by` columns on your model, populated by the currently authenticated user in your application.

7511.7M13](/packages/wildside-userstamps)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
