Skip to main content

Pixwel API - Xdebug

You can use xdebug on the API. Xdebug can be installed on your local development environments. It can be used for code coverage analysis also. ## Xdebug/PHPStorm integration https://confluence.jetbrains.com/display/PhpStorm/Debugging+PHP+CLI+scripts+with+PhpStorm If you are working with the docker container, you can get Xdebug working and set breakpoints in the PHP code. This means you can be using the UI and set breakpoints in the API. Xdebug is not in the standard image. To enable it, add the extension in the API Dockerfile (docker/app/Dockerfile) — the lines below install and configure it — and set the host to your machine’s IP. (The snippet is Xdebug 2 style; on the current PHP 8.2 image you’ll likely need the Xdebug 3 equivalents: xdebug.client_host, xdebug.client_port, xdebug.mode=debug, xdebug.start_with_request=yes. A starter config lives at docker/app/etc/xdebug.ini.)
RUN yes | pecl install xdebug \
     && echo "zend_extension=$(find /usr/local/lib/php/extensions/ -name xdebug.so)" > /usr/local/etc/php/conf.d/xdebug.ini \
     && echo "xdebug.remote_host=10.0.0.107" >> /usr/local/etc/php/conf.d/xdebug.ini \
     && echo "xdebug.remote_port=9009" >> /usr/local/etc/php/conf.d/xdebug.ini \
     && echo "xdebug.remote_enable=on" >> /usr/local/etc/php/conf.d/xdebug.ini \
     && echo "xdebug.remote_autostart=on" >> /usr/local/etc/php/conf.d/xdebug.ini \
then:
docker-compose up --build
If you’re using PHPStorm, click the button that’s labelled like “hang up the phone”. Then, when you hit some breakpoints, you should get a mapping screen. Map your local api/ to remote /var/www/api. That should be it!
TODO: These instructions haven’t been tested in a while, please test and update.

Back to docs index | API docs index