This is the archived manual for RedBeanPHP 3.X series.
RedBeanPHP is a lightweight, configuration-less ORM library for PHP. Let's look at the code, this is how you do CRUD in RedBeanPHP:
$post = R::dispense('post');
$post->text = 'Hello World';
$id = R::store($post); //Create or Update
$post = R::load('post',$id); //Retrieve
This code creates, stores, loads and deletes a single post object. This code will run without any prior configuration. RedBeanPHP automatically generates the database, tables and columns on-the-fly. RedBeanPHP infers relations based on naming conventions.
RedBeanPHP is a simple, easy-to-use, on-the-fly object mapper, especially suited for RAD, prototyping and people with deadlines. RedBeanPHP creates tables, columns, constraints and indexes automatically so you don't have to switch between your database client (phpMyAdmin) and your editor all the time (this does not mean you will never have to use phpMyAdmin or SQL though, read on... ). Also you don't have to write configuration files because RedBeanPHP simply infers the database schema from naming conventions. Because RedBeanPHP saves a lot of time you can spend more time developing the rest of the application.
Most ORMs use configuration files (XML, INI or YAML) or some sort of annotation system to define mappings. These systems force you to map records to objects upfront. RedBeanPHP is different. Instead of using configuration it uses conventions; a very small set of rules. RedBeanPHP uses these conventions to infer relationships and to automate mappings. RedBeanPHP also helps you to follow these conventions by automatically building the initial tables and columns for you - which also saves a lot of time. This means there is no configuration, less boilerplate code and more time left to focus on the business logic, testing and documentation, thus boosting development productivity and code quality.
SQL is a powerful query language for relational databases. Most ORMs act like a wall, hiding SQL from you. RedBeanPHP on the other hand tries to integrate both technologies, thus acting more like a bridge. For instance, RedBeanPHP allows you to embed SQL snippets in ORM methods to tune the retrieval of related beans from the database. RedBeanPHP seeks to strike a balance between object oriented programming and relational database querying.
RedBeanPHP has been carefully architected to be concise and maintainable. The core codebase is tested daily using about 20.000 unit tests (100% test coverage) on local servers and a Travis CI environment. The codebase contains a lot of inline documentation, is fully object oriented and improves security by promoting PDO based prepared statements and parameter binding.
Try the 5-minute guide to RedBeanPHP to get started quickly. Learn to use basic RedBeanPHP ORM in just about 5 minutes. Otherwise, if you're not in a hurry but you just want to get started and learn the basic concepts I recommend to start with Create a Bean (see navigation block on the left) and work your way through the manual from there. I have tried to put the most important (read: basic) topics on top of the list.
RedBeanPHP has been compiled into one single file for easy installation. No paths, no auto-loaders,
no configurations, just download the all-in-one package and require the single rb.php file
in your code.
DOWNLOAD Latest RedBeanPHP (Version 3.5.5).
RedBeanPHP Easy ORM for PHP © 2022 Gabor de Mooij and the RedBeanPHP community - Licensed New BSD/GPLv2