title: Debugging Laravel application on VSCode
body: <p>Has anyone successfully configured VSCode to debug Laravel-based website? After having followed numerous articles and tutorials, I have made it to the point where I can ask VSCode to "Listen to XDEBUG", but I haven't been able to do <em>normal</em> VS-style debugging where I could just hit F5 to launch current the website in my favorite browser and it would break into VSCode when it hit a breakpoint, just like we do in full Visual Studio or Eclipse.</p>
  
  <p>I have following things correctly setup on my machine:</p>
  
  <ul>
  <li>VSCode 1.25.1</li>
  <li>XAMPP 1.8</li>
  <li>XDEBUG (configured and working)</li>
  <li>PHP Debug extension for VSCode</li>
  </ul>
  
  <p>I'm not sure what launch configuration do I need to use in my <code>launch.json</code>. The two configurations that come with PHP Debug extension look like this:</p>
  
  <pre><code>{
      "name": "Listen for XDebug",
      "type": "php",
      "request": "launch",
      "port": 9000
  },
  {
      "name": "Launch currently open script",
      "type": "php",
      "request": "launch",
      "program": "${file}",
      "cwd": "${fileDirname}",
      "port": 9000
  }           
  </code></pre>
  
  <p>While the first configuration works correctly (I can start debugging in that mode in VSCode, then launch my website separately in the browser and it hits the breakpoints), the second configuration fails. It tells me that it cannot locate <code>Controller</code> class (which is a Laravel framework class). Qualifying class name with namespace doesn't do any good either.</p>
  
  <p>My guess is that this has got something to with how the launch configuration is setup. It tries to launch the active script as an independent unit and thus fails to locate the definition of framework classes located in different files. We have to somehow provide launch the website as a single application.</p>
  
  <p>Has anyone done that successfully and tell me what I'm missing here?</p>