Skip to content

Instantly share code, notes, and snippets.

@aminin
Last active May 4, 2019 15:33
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aminin/30a6f68d31382579245f to your computer and use it in GitHub Desktop.
Save aminin/30a6f68d31382579245f to your computer and use it in GitHub Desktop.
Run symfony application with xdebug

PHP and IDE configuration

Assume we already configured xdebug (otherwise use google).

Symfony 2.x

Shell command

This code is very similar to the command executed internally by php app/console server:run.

XDEBUG_CONFIG="idekey=phpstorm" php -S 127.0.0.1:8000 -t web/ \
    vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Resources/config/router_dev.php

Load source framework classes rather than minified ones

diff --git a/web/app_dev.php b/web/app_dev.php
index f973a04..829d972 100755
--- a/web/app_dev.php
+++ b/web/app_dev.php
@@ -17,7 +17,8 @@ if (isset($_SERVER['HTTP_CLIENT_IP'])
     exit('You are not allowed to access this file. Check '.basename(__FILE__).' for more information.');
 }
 
-$loader = require_once __DIR__.'/../app/bootstrap.php.cache';
+//$loader = require_once __DIR__.'/../app/bootstrap.php.cache';
+$loader = require_once __DIR__.'/../app/autoload.php';
 Debug::enable();
 
 require_once __DIR__.'/../app/AppKernel.php';

Symfony 3.x

Shell command

XDEBUG_CONFIG="idekey=phpstorm" APP_FRONT_CONTROLLER=web/app_dev.php php -S localhost:8002 -t web/ \
    vendor/symfony/symfony/src/Symfony/Bundle/WebServerBundle/Resources/router.php
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment