Including external php files

I’ve got one old “project” that handles exporting reports in certain format based on the user input that I’d like to include to my Yii2 application.

There’s some information here:

…but I don’t want to make that “project” as a component but include as-is with minimum changes. How can this be achieved?

With regular

require "path/to/file.php";

Does not work, Class ‘app\models\Calculator’ not found. With any class that I try to instantiate from the included php-file. What’s the problem?

Do you have a namespace defined inside that class?

Yes, added yesterday and it started working. Thanks for the help!