Quick Tip: PSR-0 Namespaces in Sugar 7

Post originally written by Jesse.

If you want to use namespaces following the PSR-0 standard for your custom code, it is now possible with the SugarAutoLoader in sugar7. Now you don't have to insert require statements all over the place.
require_once('include/utils/autoloader.php');

SugarAutoLoader::addNamespace('Fbsg\\', 'custom/include/Fbsg');

Sugar's autoloader will now map requests for the class Fbsg\Example\Test to the file "custom/include/Fbsg/Example/Test.php".

Post From Faye Business Systems Group Director of Development Matthew Strickland

Contact Jesse Heller