Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

NielsNumbers's avatar

How to sync routes when refactor Controller with PHPStorm?

If I click on the namespace of a controller and press F6 I can rename the namespace and the controller will be moved into the according directory.

However, this will not update the use of the namespace in the routes routes/web.php file.

For example Route::get('businessdocument/{type}/{country}/{lang}', 'Documents\BusinessDocumentController@downloadDocument')->where('type', '[0-9]+');

will remain unchanged even if I change the namespace in BusinessDocumentController.

Can I use settings in PHPStorm to automatically update routes?

0 likes
2 replies
SilenceBringer's avatar

Hi @elenktik. No. Here 'Documents\BusinessDocumentController@downloadDocument' your controller name passed as a string, PhpStorm do not parse it when refactor

Please or to participate in this conversation.