You can use the following syntax:
use App\Http\Controllers\{Controller1,Controller2,Controller3,Controller4}
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
I have a question regarding using multiple controllers at the beginning of any php file. e.g. in routes/web.php file, sometimes we have to use controllers like this:
use App\Http\Controllers\Controller1;
use App\Http\Controllers\Controller2;
use App\Http\Controllers\Controller3;
use App\Http\Controllers\Controller4;
my question is "is there any concise or short syntax" to write such lines in one go as there is a repetition of 'use App\Http\Controllers' in every single line?
Thanks
You can use the following syntax:
use App\Http\Controllers\{Controller1,Controller2,Controller3,Controller4}
Please or to participate in this conversation.