• Stars
    star
    356
  • Rank 119,079 (Top 3 %)
  • Language
    PHP
  • License
    Apache License 2.0
  • Created almost 4 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Yet Another Swoole Debugger

English | ไธญๆ–‡

yasd

Swoole 5.0.1 + PHP 8.1 already support xdebug, so there is no need to use the yasd debugger!

Yet Another Swoole Debugger. document

How to use it

Notice: if you use Swoole\Server, set the worker_num to 1, otherwise the breakpoint may fail.

build

You'll need to install the Boost library first.

macOS:

brew install boost

Ubuntu:

apt-get install libboost-all-dev

CentOS:

yum install boost boost-devel
phpize --clean && \
phpize && \
./configure && \
make clean && \
make && \
make install

set the ini file:

zend_extension=yasd

see the extension info:

php --ri yasd

IDE debug mode

zend_extension=yasd
yasd.debug_mode=remote
yasd.remote_host=127.0.0.1
yasd.remote_port=9000

cmd debug mode

All command supports fuzzy matching of priorities.

set the ini file:

zend_extension=yasd
yasd.debug_mode=cmd

start debug

php -e test.php

list

l

list source code

breakpoint

b absolute-file-path lineno

This will also save the breakpoint information in the cache file -- .breakpoints_file.log

You can change this file name by the ini file, e.g.

yasd.breakpoints_file="yasd.log"

If the cache file exists, the breakpoints in the file are automatically loaded when debug is started.

Delete breakpoints

d number

If a breakpoint is set or deleted without specifying absolute-file-path, It will set breakpoint in the current file.

watch point

We can monitor the variable changes or expression, for example:

watch $a
watch $a > 10
watch $name == 'swoole'

unwatch point

unwatch number

run

r

step over

n

step into

s

step out

f

backtrace

bt

info

show all breakpoints:

info breakpoints

show all watchpoints:

info watchpoints

continue

c

quit

q

print

p $a
p $this
p $this->prop

level

le

Q&A

Debugging with phpstorm (remote mode)

  • the port phpstorm listens on should be the one used for xdebug, also make sure remote connections are allowed: image

  • do NOT forget to use -e option when running scripts, debugging will not work otherwise

  • ensure that phpstorm listens on incoming connections:

image

Slow Start Framework

When using yasd, if the framework starts slowly (most of the time it's because the framework is scanning a lot of files), you can execute the following command.

Hyperf
composer dump-autoload -o

Then modify the following configuration config/config.php:

'scan_cacheable' => env('SCAN_CACHEABLE', true)
Imi

We did not find a slow start problem.

EasySwoole

We did not find a slow start problem.

MixPHP

We did not find a slow start problem.

Swoft

We did not find a slow start problem.

One

We did not find a slow start problem.

The breakpoint is not triggered

  1. No absolute path to the file is used
  2. The breakpoint is not a valid line, such as a function declaration, blank line, etc
  3. The code is generated with proxy classes, such as Hyperf. So you need to set breakpoints in the proxy class.

More Repositories

1

swoole-src

๐Ÿš€ Coroutine-based concurrency library for PHP
C++
18,406
star
2

phpx

๐Ÿ’— C++ wrapper for Zend API
C++
823
star
3

php-cp

pdo and redis tcp connect proxy
C
639
star
4

docker-swoole

๐Ÿ„ Official Docker Image of Swoole
Dockerfile
499
star
5

ide-helper

๐Ÿ“˜ Swoole IDE Helper
PHP
469
star
6

swoole-wiki

๐Ÿ“–Swooleๅ…จ้‡Markdownๆ–‡ๆกฃ, Swoole-Doc, Swoole-Wiki
Shell
270
star
7

phpkafka

PHP Kafka client is used in PHP-FPM and Swoole. PHP Kafka client supports 50 APIs, which might be one that supports the most message types ever.
PHP
266
star
8

awesome-swoole

๐Ÿ’Ž A curated list of awesome things related to Swoole.
230
star
9

library

๐Ÿ“š Swoole Library
PHP
221
star
10

grpc

๐Ÿ’Ž Grpc client based on Swoole Coroutine
PHP
199
star
11

ext-zookeeper

๐Ÿง‘ Coroutine-based ZooKeeper Client for PHP
C
150
star
12

swoole-cli

SWOOLE-CLI is a php binary distribution composed swoole & php-core & cli & fpm and mostly of common extensions.
C
119
star
13

community-chinese

Swoole ๆๆกˆ
117
star
14

thrift-rpc-server

Thrift RPC Server based on swoole
PHP
115
star
15

auto_reload

Inotify็›‘ๆŽงๆ–‡ไปถๅ˜ๆ›ด่‡ชๅŠจ้‡ๅฏswoole_server
PHP
105
star
16

ext-serialize

the fastest serialize function bound for php7
C
93
star
17

ext-async

Asynchronous callback client
PHP
87
star
18

proxy-server

Full asynchronous proxy server can support over a large number of concurrent.
PHP
84
star
19

debugger

Swoole ่ฟœ็จ‹่ฐƒ่ฏ•ๅ™จ
PHP
79
star
20

ext-postgresql

๐Ÿ˜ Coroutine-based client for PostgreSQL
C++
64
star
21

swoole-docs

๐Ÿ“— Please check the latest version: https://www.swoole.co.uk/docs/
61
star
22

phpy

PHP
43
star
23

zmq

ZeroMQ bindings for Swoole
PHP
37
star
24

dashboard

Vue
22
star
25

php-docker

php docker file
Dockerfile
20
star
26

docs

PHP
10
star
27

benchmark

PHP
9
star
28

make-library

Convert PHP code to C/C++ header file
PHP
6
star
29

documents

2
star
30

swoole.github.io

Swoole's website, docs & blog mainly focused on the english-speaking community.
CSS
2
star
31

v4.4-lts

C++
1
star
32

golang-h2demo

Go
1
star