with Interface and Trait, we can seamless integrated 3th party library to Yii
for example
we have “3thparty/DiviceDetect” library, and integrated to Yii
yii/base/ComponentInterface , yii/base/ComponentTrait
we can create new yii component like this :
class 3thparty/yii/DiviceDetect
extend 3thparty/DiviceDetect
implement yii/base/ComponentInterface
{
use yii/base/ComponentTrait;
}
next we can check like this
if ($cls instanceof yii/base/ComponentInterface) {
echo "yes";
}