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

Moonbird's avatar

Class paths not found during debug in PHPSTORM

I succesfully installed Laravel and PhpStorm, using windows 8.1 and Wamp (www/laravel).

In the default Laravel installation we see the namespace: App\Http\Controllers. HomeController extends Controller in that namespace. All works fine on localhost, and when I change some content it is visible. No problem there, I could run a mini website.

PhpStorm uses Xdebug, which is setup correctly in my php.ini and PhpStorm, as I did check. Now when I debug my homecontroller or any end controller, it sais that the underlying Controller Class cannot be foud. Like so:

PHP Fatal error: Class 'App\Http\Controllers\Controller' not found in C:\wamp\www\laravel\app\Http\Controllers\HomeController.php on line 3. (extit code 255).

However, controller.php is there, in the right namespace, with the right syntax. And the class is working fine on localhost.To be sure I tried the "use" statement in homeController, although I know I dont need to. I checked all settings, plugins etc. One thing came up which also is related to debugging:

When I select the entire controller directory with my mouse and run debug, I get: Process finished with exit code 1. Cannot find PHPUnit in include path (.;C:\php\pear)

So I checked PHPUnit settings and tried the option with a path to a .phar file, which I then downloaded because it did not come in the composer installation. (C:\wamp\www\laravel\vendor\phpunit\phpunit\phpunit.phar). Then I got: PHPUnit 4.5.0 by Sebastian Bergmann and contributors. Time: 201 ms, Memory: 2.25Mb No tests executed! Process finished with exit code 0.

I explored more in depth vids and tuts about Xdebug, without results.

I also tried stuff like 'composer dump-autoload' which did not help and php artisan dump-autoload which does not execute. Even tried a classmap autoload in composer's 'installed.json' with the correct path, as could be copied from a Jeffrey tutorial.

I tried PhpStorm 8.3 (using 8.1), same results.

So basically:

  1. Laravel Class paths cannot be found while debugging, but the files are there right from the setup. Syntaxes are correct.
  2. It might be related to PHPUnit , Xdebug or Laravel. I explored all ways I could think off and read the forums. In Google I found 2 more or less similar cases but without a solution.

So I hope this post might help. Cheers!

0 likes
8 replies
isaackearl's avatar

I don't know if I fully understand your problem, but I know that phpstorm didn't properly load all the classes and namespaces etc until I started using ide-helper (https://github.com/barryvdh/laravel-ide-helper). now it generates a helper file for all the namespaces etc and also a models file. Sorry if this doesn't help, or if you already have that implemented and I'm just not understanding!

Moonbird's avatar

Hi, thx, I thought of that too and had it installed as follows: composer require barryvdh/laravel-ide-helper. It did not resolve the issue.

I made a simple test now which shows is is not a namespace issue. I made 2 empty classes: Test2 extends Test1. When I debug test 2:

PHP Fatal error: Class 'Test1' not found in C:\wamp\www\laravel\app\Http\Controllers\test2.php on line 3 Fatal error: Class 'Test1' not found in C:\wamp\www\laravel\app\Http\Controllers\test2.php on line 3

SachinAgarwal's avatar

after installing ide-helper did you run it through you artisan command? It will generate a file for phpstorm.

And if that do not help then once run this command and try

php artisan clear-compiled
Moonbird's avatar

Yeah I did

  1. php artisan clear-compiled
  2. php artisan ide-helper:generate
  3. php artisan optimize

In my root (www/laravel) there is the _ide_helper.php

Moonbird's avatar

Yes, my shoulder even hurts from it. I also update composer and autoload stuff.

Moonbird's avatar

Checked phpunit settings again and tested a page that does not extend a class. Code debugging works correctly.

So, on my system/configuration, phpstorm or something in phpstorm is just not capable of finding a parent class. As soon as a class extends something, I get a fatal error when I run the debugger.

ali-hellani's avatar

@Moonbird , i faced the same problem as described above especially when there is extend class but after hours of searching and try/error, i found where the problem is and i solved it and it is working now at least on my part.

turned out it was an issue in xdebug 2.2 but it is fixed in Xdebug 2.2.0RC2 . upgrading it, has solved the problem and it is working now like a charm. so, if you have version 2.2 of xdebug, please upgrade, it will solve your problem. but be careful, you need to know which version file to download because it must supports your php version.

this page (http://xdebug.org/wizard.php) will helps you finding which file to download. personally i have: wamp 2.2e 32 bits / php 5.4.3 / Apache 2.2.22 / Compiler: MS VC9 => my xdebug now is 2.3.2

then follow the instructions provided by @JeffreyWay in this lesson https://laracasts.com/series/how-to-be-awesome-in-phpstorm/episodes/20

Please or to participate in this conversation.