Integration of vendor libraries in the Yii framework


For the use of foreign libraries such as Facebook for PHP SDK in the Yii framework the folder structure provides vendors folder in protected/vendors.
Can be copied in libraries in a subfolder.
There are for the use of the library 2 Scope:

The integration in the autoloading

This has the advantage of, that nciht more embed the library in use at various points in the application must be care.
The disadvantage is, the autoloading takes longer from all components, because a path more must be scanned for the appropriate class.
This can be adjusted in the config/main.php:

 'import'=>array(
    'application.vendors.facebook.*',
 ),

Direct charging for use of the library

If the library only at reasonable times is used it is worth to load the library at run time with the import Command:

Yii::import('application.vendors.facebook.facebook);

or directly with

require_once 'vendors/myFacebook/facebook.php';

to include, especially , If does not match the file name and class name, What is a Convention of the Yii framework.