https://github.com/mevdschee/ws2api-php
https://github.com/mevdschee/ws2api-php
Last synced: 6 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/mevdschee/ws2api-php
- Owner: mevdschee
- Created: 2024-11-11T18:47:47.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2025-01-15T21:07:02.000Z (12 months ago)
- Last Synced: 2025-04-22T22:18:12.854Z (9 months ago)
- Language: PHP
- Size: 43 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# WS2API PHP OpenSwoole
This is a port of the [WS2API](https://github.com/mevdschee/ws2api) Go project
into OpenSwoole.
Both implementations are about 200 lines of code and this implementation
performs worse than the original that is written in Go.
### Installation
Follow https://openswoole.com/docs/get-started/prerequisites to install
openswoole, run:
sudo apt install gcc php-dev openssl libssl-dev curl libcurl4-openssl-dev libpcre3-dev build-essential
sudo apt install php-curl php-json php-mysql php-common
sudo pecl install openswoole-22.1.2
echo extension=/usr/lib/php/20230831/openswoole.so | sudo tee /etc/php/8.3/mods-available/openswoole.ini
sudo ln -s /etc/php/8.3/mods-available/openswoole.ini /etc/php/8.3/cli/conf.d/30-openswoole.ini
Run to verfy succesful installation:
echo "phpinfo();" | php -a | grep openswoole
I get:
/etc/php/8.3/cli/conf.d/30-openswoole.ini
openswoole
Author => Open Swoole Group
openswoole.display_errors => On => On
openswoole.enable_coroutine => On => On
openswoole.enable_preemptive_scheduler => Off => Off
openswoole.unixsock_buffer_size => 8388608 => 8388608
Which is what is expected.
### Uninstallation
Remove the symlink:
sudo rm /etc/php/8.3/mods-available/openswoole.ini
You can ensure that this extension is no longer installed using:
echo "phpinfo();" | php -a | grep openswoole
It should not show any variables.
### Development
To install dev dependencies:
wget getcomposer.org/composer.phar
php composer.phar install
Now you can start editing in Visual Studio Code (Intelephense)
### Running
You can run the code using:
php src/server.php
Enjoy!