C
C
Crash2017-03-09 15:48:01
Yii
Crash, 2017-03-09 15:48:01

How to inject a third party component in Yii2 that doesn't use namespaces?

I can't embed a component in Yii2 at all. It's from an old project, namespaces are not used. I connected it like this:
0f9f20b565524c6583bd3f2ee6d6bc4a.jpg

$phprtf = Yii::getAlias('@app') . '/extensions/phprtf/PHPRtfLite.php';
 include($phprtf);

I'm starting to use:
$rtf = new \PHPRtfLite();
$rtf->setLandscape();
$rtf->setMarginLeft(0.5);

And then the trouble begins, he does not see his files:
03a494fb739344c4b1a6e15dc891833e.jpg
As far as I understand, Yii2, unlike the first one, imports third-party modules not by including files, but through namespaces. But transferring the old component to namespaces is not an option, there is work for several days. A component is needed now. What to do, how to be?
PS I tried to include files in the component folder recursively, but I started swearing at "class not found", apparently due to the wrong connection order

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
vism, 2017-03-09
@Bandicoot

you need to complement the yii autoloader or write another autoloader and add it to the loader collection. So that he hawal these classes.
I don't remember, I did it a year ago

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question