Skip to content
This repository has been archived by the owner on Jul 23, 2021. It is now read-only.
/ yasd-demo Public archive

How to use the Swoole debugger yasd with Phpstorm.

Notifications You must be signed in to change notification settings

deminy/yasd-demo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

This demo is to show how to test the Swoole debugger yasd with Phpstorm.

How to Use Yasd With Phpstorm

  • In Phpstorm, please
    • Update Xdebug settings under Languages & Frameworks > PHP > Debug > Xdebug:
      • Debug port: 9000
      • Option "can accept external connections" is checked.
    • Add a new server
      • Name: demo
      • Host: 127.0.0.1
      • Port: 80
      • Debugger: Xdebug
      • Check checkbox "Use path mapping", and map the root directory of this repository to /var/www (the absolute path on the server).
  • In Phpstorm, add some breakpoints in file server.php.
  • Enable option "Start listening for PHP Debug connections" in Phpstorm.
  • We use port 9000 on the host for debugging. Please make sure it's not used by any other processes. You can use command lsof -i :9000 to check which program is using port 9000.
  • Use command docker-compose up or docker-compose up -d to start the container.
    • In file docker-compose.yml, Docker environment variable PHP_IDE_CONFIG is set to serverName=demo in the container. demo is the server name set in Phpstorm.
  • After the container is started, you can use command php --ri yasd in the container to check yasd settings.
  • Visit URL http://127.0.0.1 in your browser to start debugging.

Commands for Local Development

# To start the container
docker-compose up

# (Optional) To build the Docker image.
docker build -t deminy/yasd-demo .
docker exec -ti $(docker ps -qf "name=app") env | grep PHP_IDE_CONFIG
docker exec -ti $(docker ps -qf "name=app") php --ri yasd
docker exec -ti $(docker ps -qf "name=app") cat /usr/local/etc/php/conf.d/docker-php-ext-yasd.ini
docker exec -ti $(docker ps -qf "name=app") tail -f debug.log # Only when option "yasd.log_level" is set to 0.

docker exec -ti $(docker ps -qf "name=app") sh # To get access to a shell

About

How to use the Swoole debugger yasd with Phpstorm.

Topics

Resources

Stars

Watchers

Forks