RedBeanPHP
{{Infobox software
| logo =
| name = RedBeanPHP
| latest release version = 5.7
| latest release date = {{release_date|2021|04|03}}
| operating_system = Cross-platform
| programming language = PHP
| genre = Object–relational mapping library
| website = {{url|https://redbeanphp.com}}
}}
RedBeanPHP is an independent, free, BSD licensed, open-source object–relational mapping (ORM) software written by Gabor de Mooij. It is a stand-alone library, not part of any framework. RedBeanPHP is an on-the-fly object–relational mapper, this means there is no upfront configuration. The system relies on conventions entirely and adapts the database schema to fit the needs of the program. This way, it strikes a balance between NoSQL and traditional RDBMS solutions.
Features
RedBeanPHP is different from other ORM systems because it requires no configuration in XML, YAML or JSON. It adapts the database schema based on the needs of the program. All tables and columns are created on-the-fly, without upfront configuration or mapping. It automatically adds columns to tables if necessary and changes the type of the column to match its content requirements. When the developer is done developing and no more schema changes are expected, the schema can be frozen for deployment to production environments. After freezing the database no more schema alterations take place. Relations among tables are mapped in the same way: by convention. For instance, to create a one-to-many relationship between two tables one assigns an array to the property bearing the name of the target table. This automatically creates the table as well as the required columns.
Code example, demonstrating a simple CRUD operation and a relation:
R::setup();
$movie = R::dispense('movie');
$movie->title = 'Beans in space';
$character = R::dispense('character');
$character->name = 'hero';
$movie->ownCharacterList[] = $character;
$id = R::store($movie);
Influence
RedBeanPHP is the first library known to adopt the on-the-fly approach towards ORM. As such it has a big influence on other libraries. RedBeanPHP inspired many other projects to embrace this approach towards object mapping. Similar libraries have appeared for .NET,[https://github.com/Nick-Lucas/LimeBean/ LimeBean, RedBeanPHP-inspired data access layer for .NET] Python,[https://pypi.python.org/pypi/pybean/0.2.1 PyBean, RedBeanPHP inspired ORM for Python] JavaScript,{{Cite web|url=https://www.npmjs.com/package/Tayr|title=Tayr|website=npm|access-date=2016-07-02}} Java,[https://github.com/dkornishev/redbean4j RedBean4J RedBean inspired ORM for Java (now abandoned)] Erlang,[https://github.com/niahoo/redbean-erlang RedBean-Erlang] ColdFusion[https://github.com/Prefinem/RedBeanCF RedBeanCF] and Objective-C.[https://github.com/RJR/CocoaBean CocoaBean, RedBeanPHP inspired library for Objective-C]
Integration
While being an independent library, plugin modules have been developed for various popular frameworks like: Laravel,[http://bundles.laravel.com/bundle/redbean33 RedBeanPHP bundle for Laravel] CodeIgniter,[http://jenssegers.be/projects/codeigniter-redbean codeigniter-redbean plugin for the CodeIgniter Framework] Kohana,[https://github.com/shideon/kohana-redbean Kohana Integration module] Silex[https://connect.sensiolabs.com/profile/ivoba/project/redbean-service-provider RedBean Service Provider for Silex] and Zend Framework.[http://richardjh.org/blog/using-redbeanphp-orm-zend-framework/ Zend Framework integration of RedBeanPHP] Besides integration modules, some frameworks ship with RedBeanPHP out-of-the-box like The Nibble Framework.[http://nibble-development.com/nibble-framework-php-plugin-based-framework/ Nibble Framework: a plugin-based framework for PHP]
History
RedBeanPHP first appeared in 2009 on GitHub.[https://github.com/gabordemooij/redbean/commit/61e46ec96562ba0fe6dd70f897ee2bcbf2665f38] First commit of RedBeanPHP on Github The first publicly available version was 0.3.3. RedBeanPHP has been developed by Gabor de Mooij, a software developer from the Netherlands. Because RedBeanPHP is very accessible and it does not hide the SQL language it is used by Universities to teach database programming.http://www.cs.wcupa.edu/rkline/wp/mysql-php.html The West Chester University Computer Science Department RedBeanPHP course According to a forum post by Gabor himself the library has been inspired by a rant about object relational mapping systems by Ted Neward called the 'ORM, Vietnam of computer science'.[https://groups.google.com/forum/?fromgroups#!searchin/redbeanorm/vietnam/redbeanorm/bUD8lBub2i0/0iPvvcs7WugJ Post on forum detailing inspiration for RedBeanPHP][http://blogs.tedneward.com/2006/06/26/The+Vietnam+Of+Computer+Science.aspx The Vietnam of Computer Science] {{webarchive|url=https://web.archive.org/web/20100430190545/http://blogs.tedneward.com/2006/06/26/The+Vietnam+Of+Computer+Science.aspx |date=2010-04-30 }}
Reception
Based on the reviews and presentations available on the web, the overall reception of RedBeanPHP seems to be positive.[https://www.sitepoint.com/introduction-redbean/ SitePoint Review of RedBeanPHP][http://7php.com/interview-zurmo-crm/ Interview CEO Zurmo, mentions RedBeanPHP]{{usurped|1=[https://archive.today/20140528070214/http://www.dreamincode.net/forums/blog/1267/entry-4106-a-simple-elegant-php-orm-library-redbeanphp/ RedBeanPHP Review by Dreamincode]}}[http://www.6zou.net/tech/review-of-redbeanphp-work-with-existing-database.html Review of RedBeanPHP with existing database] However the library is less suitable for projects with existing databases and does not support custom table and column mappings, for instance it is not possible to use table prefixes.[https://redbeanphp.com/about#checklist Checklist suitable projects on the RedBeanPHP website] Also, none of the major frameworks has incorporated the library.
See also
{{Portal|Computer programming}}
References
{{reflist|30em}}
External links
- {{Official website|https://redbeanphp.com|RedBean official website}}
- [http://www.gabordemooij.com Author's Home Page]