I dynamically generate my use statements and try to include them.
use.php (Path: /App/Test/Use/use.php)
<?php
use App\Http\Utility\GeneralUtility;
use App\Models\Project;
use App\Http\Selenium;
?>
PlayController.php (Path: /App/Http/Controllers/PlayController.php)
<?php
namespace App\Http\Controllers;
require app_path() . '\Projects\Test\Use\use.php';
...
However, If I try to use a included/required class in my controller then I get the info that some classes are missing. E.g.
FatalThrowableError in PlayController.php line 30:
Class 'App\Http\Controllers\Selenium' not found
Of course it works If I write them manually into the Controller without using require
:
<?php
namespace App\Http\Controllers;
use App\Http\Utility\GeneralUtility;
use App\Models\Project;
use App\Http\Selenium;
...
So why does it not work if I include / require them?
via EdwardBlack