@@ -26,6 +26,117 @@ Install `dotkernel/queue` by executing the following Composer command:
2626composer require dotkernel/queue
2727```
2828
29+ ## Setup
30+
31+ In order to setup the server run the following commands:
32+
33+ Install Valkey
34+ ``` shell
35+ sudo dnf install valkey
36+ ```
37+
38+ Start Valkey service
39+ ``` shell
40+ sudo systemctl start valkey
41+ ```
42+
43+ Enable Valkey to start automatically at system boot.
44+ ``` shell
45+ sudo systemctl enable valkey
46+ ```
47+
48+ Install php-redis extension, which allows PHP to communicate with Valkey/Redis.
49+ ``` shell
50+ sudo dnf install php-redis
51+ ```
52+
53+ Restart Apache HTTP Server and PHP-FPM
54+ ``` shell
55+ sudo systemctl restart httpd
56+ sudo systemctl restart php-fpm
57+ ```
58+
59+ Check whether the redis extension is loaded in PHP
60+ ``` shell
61+ php -m | grep redis
62+ ```
63+
64+ Install build tools and development packages
65+ ``` shell
66+ sudo dnf install php-devel php-pear gcc make
67+ ```
68+
69+ Install the Brotli compression library and its development headers
70+ ``` shell
71+ sudo dnf install brotli brotli-devel
72+ ```
73+
74+ Check if pkg-config can locate the libbrotlienc library
75+ ``` shell
76+ pkg-config --libs libbrotlienc
77+ ```
78+
79+ Ensure pkg-config can find .pc config files by updating the environment variable with the correct path
80+ ``` shell
81+ export PKG_CONFIG_PATH=/usr/lib64/pkgconfig:$PKG_CONFIG_PATH
82+ ```
83+
84+ Install the Swoole PHP extension via PECL
85+ > Note: PECL options should be left default.
86+ ``` shell
87+ sudo pecl install swoole
88+ ```
89+
90+ Navigate to PHP’s config files
91+ ``` shell
92+ cd /etc/php.d/
93+ ```
94+
95+ Create a new config file for the swoole extension.
96+ ``` shell
97+ sudo touch 60-swoole.ini
98+ ```
99+
100+ Open the file in your preferred editor
101+ ``` shell
102+ sudo nano 60-swoole.ini
103+ ```
104+
105+ Add the following extension and save
106+ ``` shell
107+ extension=swoole.so
108+ ```
109+
110+ Restart services
111+ ``` shell
112+ sudo systemctl restart php-fpm
113+ sudo systemctl restart httpd
114+ ```
115+ Check if swoole extension is loaded in PHP
116+ ``` shell
117+ php -m | grep swoole
118+ ```
119+
120+ ## Usage
121+
122+ In order to start or stop the swoole server to you can run the following commands
123+ ``` shell
124+ php bin/cli.php swoole:start
125+ ```
126+ ``` shell
127+ php bin/cli.php swoole:stop
128+ ```
129+
130+ In order to start the messenger server run the following command
131+ ``` shell
132+ php bin/cli.php messenger:start
133+ ```
134+
135+ To test if everything is working properly you can simulate sending a message via TCP by running the following command
136+ ``` shell
137+ echo " Hello" | socat - TCP:localhost:8556
138+ ```
139+
29140## Documentation
30141
31142Documentation is available at: https://docs.dotkernel.org/queue-documentation
0 commit comments