|
Brief introduction
Configure Laravel in PhpStorm the breakpoint debugging, there are two ways, the first is the most common, direct configuration and installation of a chrom look phpstorm plug can be, but this approach has some drawbacks, is the very API debugging easy, such as Ajax or client requests:
http://laravelista.com/debugging-a-laravel-web-application-with-phpstorm-on-homestead/
http://www.sitepoint.com/install-xdebug-phpstorm-vagrant/
There is also a more general way, is both a genius to know through phpstorm interceptor function, can intercept any PHP request, also need to install a plug-in chrome:
https://phphub.org/topics/553, summed up very well, but only after I found this article summarizes finished, otherwise I do not write
https://laracasts.com/forum/?p=1648-phpstorm-homestead-xdebug/0, to explain in great detail in this article, it is praise
https://www.youtube.com/watch?v=LUTolQw8K9A
http://blog.elenakolevska.com/debugging-laravel-on-homestead/, this article is talking about can be, but on the inside the port settings and the path mapped speak flawed aspect, I wasted most of the day time to correct this problem
Configuring php.ini
After logging vagrant, use "sudo vim /etc/php5/fpm/conf.d/20-xdebug.ini" command to edit the configuration file xdebug, I basically do not have to make changes to this file, the configuration file as follows
Configuration PhpStorm
First, you can refer to http://blog.elenakolevska.com/debugging-laravel-on-homestead/ in PhpStrom to configure vagrant options. Select Preferences -> Languages & Frameworks -> PHP.
Click on the arrow pointing to the button, and then click on the "+" button, select "Remote"
Select Vagrant and set the root directory vagrantfile, that folder is selected HomeStead
After configuration is as follows:
You can click on the "Test connection" to test the configuration is working.
Configure Chrome
First we need to install Xdebug helper browser plug-ins to add parameters in the request, like: XDEBUG_SESSION_START = session_name.
Chrome: https://chrome.google.com/webstore/detail/xdebug-helper/eadndfjplgieldjbigjakmdgkmoaaaoc;
Firefox: https://addons.mozilla.org/en-US/firefox/addon/the-easiest-xdebug/
Safari: https://github.com/benmatselby/xdebug-toggler
My development environment is Chrome at the mac. After installation, you can Xdebug helper some settings, for example, only for a specific domain name to start plug, which set white list. To access the plug-in setup options, first open the chrome plugin management page, click Xdebug helper options.
Under Options, set the IDE key to PhpStorm, and homestead.app added to the Domain filter, so that you will only be displayed for the domain debug plug.
After the plug-in installation, enter the white list domain names in a browser, I have here is homestead.app, you can see the plug-in icon in the address bar, click on the icon, select Start Debug.
Debugging
After the setup is complete environment, we want to begin with PHP debug. Click Run -> Start Listening for PHP Debug Connections,
Then enter the chrome before the domain name. That homestead.app, then PhpStorm will pop up a dialog box, select the "Accept" to.
Then choose Preferences -> Languages & Frameworks -> PHP -> Servers
Then we need to modify the item corresponding to the outer path mapping, otherwise it can only be index.php debug, and break other files will not work, http: //laravel.io/forum/08-31 -2014-homestead-phpstorm-xdebug-only-works-with-indexphp
After everything is set up, you can enjoy for a debug with PHP
POST request
When we use POSTMan debug post request, add the url query: XDEBUG_SESSION_START = PHPSTORM can, at this time the breakpoint can be intercepted. |
|
|
|