-
-
Notifications
You must be signed in to change notification settings - Fork 978
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Xdebug request directly from bin/magento #916
Comments
Sup, dude. This is what I'm using atm for that purpose.
I'll see if I can push something more meaningful for this in the future but you just have to execute:
|
From the AI overlords: Setting xdebug.start_with_request=yes means that Xdebug will start debugging every single request made to your PHP application. While this can be helpful for some developers, there are a few potential downsides:
To mitigate these downsides, consider using xdebug.start_with_request=trigger, so debugging is only enabled when a trigger parameter (such as a cookie, GET, or POST parameter) is set. This way, you can selectively enable debugging only when needed, balancing performance, and productivity. So, there is a definite performance impediment with setting I've always avoided the That said, @dmanners would |
Hi @markshust I don't know if my development workflow is weird, but I actually think a way to execute cli commands with xdebug enabled by default is pretty useful. This is what I usually do: I have a PHP script setup to enable me to do this kind of stuff. // File named: app/tests/custom.php
$syncOrder = function ($orderId) use ($objectManager) {
$orderRepo = $objectManager->get(OrderRepositoryInterface::class);
$order = $orderRepo->get($orderId);
$syncManager = $objectManager->get(OrderSyncManager::class);
$syncManager->syncOrder($order);
}; Then I call the function: bin/php-xdebug app/tests/custom.php syncOrder 1234 This way I have a more finegrained way to debug specifically what I'm trying to debug. I've seen may developers setup a controller to achieve the same result, which I think is kind of the same, but less practical to work with. Anyways, I think your comments are on point, as setting it up was not difficult and I even shared how to do it in my previous comment. |
@markshust yeah with the trigger it could be an option. Let me have a play around with how this could work. |
hey @nietoga thanks for the command. I tested it with my setup but the trigger does not seem to happen. What exactly should the server name be here or is the variable ok? Neither the variable or the name of my server in my ide made a difference. |
oh never mind @nietoga it would help if I actually set a breakpoint :D |
Well, the server name is the name you gave the server on the servers' configuration of PhpStorm. I guess you already discovered that. Also, if you want to trigger some specific stuff, these are the modules I use to test: |
Description
Would it not be possible with a change in xdebug config to trigger a call directly from
bin/magento
rather than having to setup a php cli script in phpstorm? From my understanding this could be done if we added the configxdebug.start_with_request=yes
from the default xdebug settings.Then we would just need to turn on the normal listener and run the debugger as if we were debugging through the browser then open the cli and simply run
bin/magento
The text was updated successfully, but these errors were encountered: