This is an outdated version of the Manual. Visit the NEW Manual

Namespacer

I don't like PHP namespaces, they have some issues. This article by 'Pornel' explains why. There are several reasons why I don't use namespaces in RedBeanPHP:

Also, I really like Poorman's namespacing. In fact, it does the same job as namespacing... with no additional syntax. I really like that. The less syntax the better.

Namespacer Script

For those of you who insist on using namespaces, I have written a small PHP script for you to dynamically put RedBeanPHP in a namespace: Namespace Script.
Usage:

php space.php MyNameSpaceForBeans

The command above will put the entire RedBeanPHP library in the 'MyNameSpaceForBeans' namespace. The namespace script will put the resulting PHP code in a file called:

rbn.php

This filename stands for: RedBeanPHP with Namespaces. After running this script and including the freshly generated rbn.php file, you can use the namespaced RedBeanPHP version:

For instance: R::store becomes \MyNameSpaceForBeans\R::store.

Happy namespacing... ;)


 
 

RedBeanPHP Easy ORM for PHP © 2024 Gabor de Mooij and the RedBeanPHP community - Licensed New BSD/GPLv2