Autoloading Of Namespaced Vendor Classes

Unfortunately I was not able to find the detailed description of autoloading and classes importing, so I am trying to ask here.

My goal is to find the best way to autoload namespaced vendor classes. That means to use small amount of code and keep it beautiful.

In just created webapp I am creating class-file:



namespace Testing;

class Text


    private $phrase = '';

    public function __construct($phrase = 'YES')


        $this->phrase = $phase;


    public function getIt(){

        return $this->phrase;



In main.php I added

// autoloading model and component classes






In SiteController.php::actionContact() I am adding

$text = new Testing\Text('Hello world');

Result is

Fatal error: Class ‘Testing\Text’ not found in C:\www\reports\protected\controllers\SiteController.php on line 56

How can I autoload this class?