Debugging fastly output with custom header
If we want to get all the debug info that is set in our .vcl file to get that info we need to add extra header to request, so it should look like.
To see what will drupalSettings output you can put console log in drupalSettingsLoader.js and this will give you info what is present in drupalSettings vars that is drupal pushing to JS
Get current order entity with routeMatch
One more way to get current order is to use routeMatch like
$route_name = \Drupal::routeMatch()->getParameter('commerce_order');
Xdebug with postman
Postman when used as desktop doesnt have browser plugin to add xdebug info to request, but solution is easy, just do this.
Add `XDEBUG_SESSION_START=PHPSTORM` to the query string and PHPStorm will catch the debug session as it would if you were using a browser extension.
Disable caching of JSON:API for debugging purposes
Disabling caching on JSON API endpoints doesnt seem possible with using just below in your sevices file
VS Code xdebug array cut of - max children
If you are using VS Code and xdebug you might encounter situation where you dont see all the array entries and drupal has huge arrays, reason for this is xdebug setting and its default, to fix this you need to make script for xdebug like this with "max_children": 999,
Decoupling simple config or any other drupal data
Using JSON API or commerce api or even JSON API resources is great but it is limited to entities and whole architecture is aimed at them. This is fine in most cases but what if you want to output some config or some random data. You will need to get creative a bit. So what we do is then make custom drupal 8 controller, you setup the usual router yml like
VS Code xdebug on remote server
You may want to xdebug site on remote server, maybe you dont even want to run site locally but just have remote server running the site and codebase to all be there. You could have development server running on some hosting. To do that first you need to
Lando, xdebug - broken
If you are using lando and xdebug, you need to make sure that your docker-php-ext-install all go through (https://docs.lando.dev/guides/installing-php-extensions-on-lando.html#_…), otherwise xdebug might not be installed properly, after that also make sure xdebug setting is