1
votes

i hope i will get some help here.

I'm quite new to debugging in phpstorm. As php framework i use Laravel installed on XAMPP. Just to demonstrate my problem i refer to the basic code of a fresh laravel install.

The current state is the following:

  • set up a fresh laravel project via composer
  • downloaded barryvdh/laravel-ide-helper via composer and set it up, so phpstorm knows all classes, aliases etc.
  • set up xdebug (phpinfo shows it all well and phpstorm recognizes it as my php debugger)

I tried to debug e.g. the routes.php which out of the box includes nothing else than this:

Route::get('/', function() {
  return View::make('hello'); });

For the "Route" alias, i get an error:

Fatal error: Class 'Route' not found

I expected xdebug to have no problems debugging this as there is the _ide_helper.php in the root of my project and because i can click on all aliases facades etc. --> getting from class to class without any problem.

Same applies for all the other classes of the laravel framework, e.g. for the "HomeController"

class HomeController extends BaseController {

where i get the same error in the debug console:

Fatal error: Class 'BaseController' not found

For me it is not far from practice to test/debug my controllers etc. so i would be happy if i can get this to work somehow.

I hope somebody of you knows how to fix this :) Thanks in advance!

EDIT

This is the composer.json

{
"name": "laravel/laravel",
"description": "The Laravel Framework.",
"keywords": ["framework", "laravel"],
"license": "MIT",
"require": {
    "laravel/framework": "4.2.*",
    "phpunit/phpunit": "4.1.*",
    "barryvdh/laravel-ide-helper": "1.*"
},
"autoload": {
    "classmap": [
        "app/commands",
        "app/controllers",
        "app/models",
        "app/database/migrations",
        "app/database/seeds",
        "app/tests/TestCase.php"
    ]
},
"scripts": {
    "post-install-cmd": [
        "php artisan clear-compiled",
        "php artisan optimize",
        "bower install"
    ],
    "post-update-cmd": [
        "php artisan clear-compiled",
        "php artisan ide-helper:generate",
        "php artisan optimize",
        "bower install"
    ],
    "post-create-project-cmd": [
        "php artisan key:generate"
    ]
},
"config": {
    "preferred-install": "dist"
},
"minimum-stability": "stable"}

I also tried a "composer dumpautoload" without success.

Thanks for your effort!

1
No suggestions by anybody? I really can't get it to work and have no further ideas on how to fix this. - philmaster88
Is anybody able to debug a laravel installation? I just tried a fresh laravel install on a mac with mamp and xdebug running. I tried to debug the standard file HomeController and routes.php Xdebug console always always tells me it exits with Error code 255 without any further information. So i assume it is not working on a mac as well. - philmaster88
Did you manage to solve that matter ? Actually i am facing it tooo. - H45H

1 Answers

0
votes

As I see your error, I'm suspecting an autoload error. Can you post your composer.json please?

I'd like to put this as comment, but I can't yet. I'll just edit this answer if I find a fix.