SugarCRM Developers

Quick Tip: PSR-0 Namespaces in Sugar 7

Blog Post created by SugarCRM Developers on Oct 15, 2014

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

Outcomes