You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
PHPSockets With WebSockets is being reborn as a modern native PHP WebSocket and realtime chat library.
3
+
> **Maintenance notice:** this repository is being actively rebuilt as a modern native PHP WebSocket and realtime chat library. The legacy 2016 implementation is preserved for historical reference, while the new Composer-based library is being implemented phase by phase.
4
4
5
-
The original project was created in 2016 as a simple educational experiment showing how to build a WebSocket server with PHP sockets, without Node.js and without socket.io.
5
+
PHPSockets With WebSockets was originally created in 2016 as an educational experiment showing how to build a WebSocket server with PHP sockets, without Node.js and without socket.io.
6
6
7
-
This repository is now being progressively redesigned as a Composer package with a clean architecture, modern PHP support, examples, tests, storage adapters, CLI commands, Laravel integration, and a stronger chat-focused developer experience.
7
+
The project is now being progressively redesigned as a Composer package with a clean architecture, modern PHP support, examples, tests, storage adapters, CLI commands, optional Laravel integration, and a stronger chat-focused developer experience.
8
8
9
9
## Current status
10
10
11
-
This repository is currently in the legacy preservation phase.
11
+
The project is currently in the **Composer foundation phase**.
12
12
13
-
The original 2016 implementation has been moved to the `legacy/` directory so it can be preserved as historical reference while the new library is built from scratch in future phases.
13
+
This means the repository already has the initial Composer package structure, PSR-4 namespace configuration, base configuration classes, PHPUnit setup, PHPStan setup, PHP CS Fixer setup, and GitHub Actions workflow.
14
+
15
+
The modern WebSocket runtime is not implemented yet.
16
+
17
+
## Installation for development
18
+
19
+
Clone the repository and install dependencies:
20
+
21
+
```bash
22
+
composer install
23
+
```
24
+
25
+
Validate the Composer package:
26
+
27
+
```bash
28
+
composer validate --strict
29
+
```
30
+
31
+
Run the test suite:
32
+
33
+
```bash
34
+
composer test
35
+
```
36
+
37
+
Run static analysis:
38
+
39
+
```bash
40
+
composer analyse
41
+
```
42
+
43
+
Check code style:
44
+
45
+
```bash
46
+
composer cs:check
47
+
```
48
+
49
+
Run all quality checks:
50
+
51
+
```bash
52
+
composer quality
53
+
```
54
+
55
+
Fix code style automatically:
56
+
57
+
```bash
58
+
composer cs:fix
59
+
```
60
+
61
+
## Requirements
62
+
63
+
The modern version targets:
64
+
65
+
- PHP 8.2 or higher.
66
+
-`ext-sockets`.
67
+
-`ext-json`.
68
+
- Composer.
69
+
70
+
Optional future features may require:
71
+
72
+
-`ext-pdo` for SQL storage adapters.
73
+
- Laravel packages for optional Laravel integration.
74
+
75
+
## Namespace
76
+
77
+
The modern library uses the following namespace:
78
+
79
+
```txt
80
+
Micilini\PhpSockets\
81
+
```
82
+
83
+
The current public entry point is:
84
+
85
+
```php
86
+
use Micilini\PhpSockets\WebSocket;
87
+
88
+
echo WebSocket::version();
89
+
```
90
+
91
+
## Current structure
92
+
93
+
```txt
94
+
src/
95
+
WebSocket.php
96
+
Config/
97
+
ServerConfig.php
98
+
ChatConfig.php
99
+
100
+
tests/
101
+
Unit/
102
+
SanityTest.php
103
+
104
+
legacy/
105
+
EasyChat/
106
+
MediumChat/
107
+
README-2016.md
108
+
NOTES.md
109
+
```
14
110
15
111
## Legacy code
16
112
17
-
The original code is available here:
113
+
The original 2016 implementation is preserved here:
18
114
19
115
```txt
20
116
legacy/EasyChat
@@ -26,6 +122,8 @@ legacy/README-2016.md
26
122
27
123
`MediumChat` contains the more advanced object-oriented version with callbacks and a better separation between the WebSocket server and the chat behavior.
28
124
125
+
The legacy implementation is kept for historical and educational purposes only. The modern library will be implemented separately and should not depend on the old code structure.
126
+
29
127
## Why the legacy code was moved
30
128
31
129
The old project was designed for PHP 5 and browser-based local testing. At that time, the server could be started by opening `server.php` in the browser or by running it manually.
@@ -53,16 +151,36 @@ The new implementation will be developed gradually and will include:
53
151
- Laravel integration.
54
152
- Tests, static analysis, and CI.
55
153
56
-
## Roadmap
154
+
## Roadmap phases
155
+
156
+
The project is being implemented phase by phase:
157
+
158
+
```txt
159
+
Phase 00: Legacy preservation.
160
+
Phase 01: Composer foundation, namespace, quality tools, and CI.
161
+
Phase 02: WebSocket protocol core.
162
+
Phase 03: Server runtime and events.
163
+
Phase 04: Chat core and unique usernames.
164
+
Phase 05: Modern EasyChat example.
165
+
Phase 06: MediumChat example with callbacks.
166
+
Phase 07: Private direct messaging.
167
+
Phase 08: Private group rooms.
168
+
Phase 09: Storage adapters and migrations.
169
+
Phase 10: CLI runtime commands.
170
+
Phase 11: Small attachments and emoji-safe payloads.
171
+
Phase 12: Bot hooks and automation events.
172
+
Phase 13: Laravel integration.
173
+
Phase 14: Release documentation and Packagist preparation.
174
+
```
57
175
58
-
Implementation will follow the project roadmap phase by phase.
176
+
## Production readiness
59
177
60
-
The first phase preserves the legacy code and creates a clean baseline.
178
+
This package is not production-ready yet.
61
179
62
-
Future phases will introduce Composer, source code structure, WebSocket protocol handling, server runtime, chat features, examples, persistence, CLI tooling, and release documentation.
180
+
The repository is currently being rebuilt. The modern WebSocket protocol, server runtime, chat system, examples, storage adapters, CLI commands, and Laravel integration will be added in future phases.
63
181
64
182
## Important note
65
183
66
-
The legacy implementation is kept for historical and educational purposes.
184
+
The goal is not only to restore an old chat demo.
67
185
68
-
The new library will be implemented separately and should not depend on the old code structure.
186
+
The goal is to transform PHPSockets With WebSockets into a modern, educational, extensible, native PHP realtime library.
0 commit comments