Spreadsheet multiplayer
Click a cell and type, move with the arrow keys, and see the cursors of other visitors. Cells are stored in SQLite, only the visible range is rendered, and edits broadcast the custom example:spreadsheet scope.
ResizeObserver dispatches a throttled event; the browser computes how many rows and columns fit, writes them into signals, and posts to a resize action that re-renders exactly the right number of cells.AB2000 into the toolbar input and press Enter. The server parses column letters and row number, centers the viewport, and moves the cursor in one round-trip.example:spreadsheet scope.$ctx->dispatch() sends back as tab-separated values for the clipboard. Ctrl+V pastes TSV from the clipboard starting at the focused cell, compatible with Google Sheets and Excel.data-on:keydown__window handler covers arrows, Tab, Enter, Escape, F2, Delete, Ctrl+C, and printable-character-to-edit, with an explicit guard so the jump input is never intercepted.example:spreadsheet scope, and each edit or cursor move broadcasts it, so every connected user sees live updates without leaking private state. A tab that comes back after it was away gets its position back from $c->tabState().withWorkerNum().| A | B | C | D | E | F | G | H | I | J | |
|---|---|---|---|---|---|---|---|---|---|---|
| 1 | ' OR 1=1-- STRIX-SHEET | hmm | aaa | ooohga boohga | ||||||
| 2 | hhell | testin | sdap | asdjj | asdasdas | 8 | ||||
| 3 | foo | testing | :)jj | = | =1 | =h4 | 6 | |||
| 4 | hmmmmmmm ok | ok | nratulations on php-via | 74546 | ww | AB3000 | 🔴 | |||
| 5 | bar | Hi | 52 | f | k | |||||
| 6 | m | r | what | 2df | 🔥 | |||||
| 7 | Nantes | ccc | 🚀 | 🚀 | 🚀 | 🚀 | 🚀 | 🔥 | ||
| 8 | test | what | 🚀 | 🚀 | 🚀 | 🚀 | 🚀 | |||
| 9 | 46 | GYATT | 🚀 | 🚀 | 🚀 | 🚀 | 🚀 | 🚀 | Eeerr | |
| 10 | ee | ddsasd | 🚀 | Brotli | Brotli | rocking | the | 🚀 | Eeerr | |
| 11 | ùlkme | zezr | gghghg | compressing | compressing | 11 MB | of | 🚀 | 44 | |
| 12 | Test | zrez | dsfs | to | to | only | 10 KB | 🚀 | cool | |
| 13 | dzrez | sdfsdfsdf | sdfsd | 🚀 | 🚀 | 🚀 | We were here | |||
| 14 | z | zre | sdfsdfsdfsdfsdf | 🚀 | hr | 🚀 | 🚀 | |||
| 15 | zzz | ee | 🚀 | 🚀 | 🚀 | 🚀 | ||||
| 16 | w | ee | 🚀 | 🚀 | 🚀 | 🚀 | 🚀 | |||
| 17 | asdasd | e | Derval | z | Dedd | grgrgr | we're so back | |||
| 18 | 🔆 | ee | t | Yo | ||||||
| 19 | 🔆 | e | dda | hi guys! | hello mate | hi m8 :o) | ||||
| 20 | e | Test | z |
Signals
viewRow / viewCol
int tab scope initial: 0 Top-left corner of the visible viewport. Private per tab and server-owned (clientWritable: false), so a POST carrying an older value cannot undo a scroll.
focusRow / focusCol
int tab scope initial: 0 Currently focused cell coordinates. Server-owned, so a key pressed before the last move reached the browser still applies from the new cell.
editing
bool tab scope initial: false Whether the focused cell is in edit mode. A commit also needs the edit startEdit opened on the server, so a key pressed before the last commit or Escape arrived writes nothing.
editValue
string tab scope initial: empty string Current cell editor input value.
Navigation params
mixed tab scope tr, tc, key, shift, dr, dc, pasted: client-writable action parameters for keyboard and mouse events.
vrows / vcols
int tab scope initial: 20, 10 Dynamic viewport dimensions written by a client-side ResizeObserver.
Actions
focusCell
Moves cursor to a cell. Commits pending edits, updates selection, broadcasts cursor position.
navigate
Keyboard navigation: arrows, Tab, Enter, Escape, PageUp/Down, Home. Auto-scrolls viewport.
startEdit
Enters edit mode on the focused cell. Prefills with typed character or current value.
commitEdit
Writes the edit value to SQLite and broadcasts the change.
scroll
Mouse wheel scrolling: moves viewport by delta rows/columns.
scrollTo
Absolute viewport positioning on one axis, used by scrollbar drag and track clicks.
clearCells
Deletes the selected range of cells.
paste
Pastes TSV clipboard data starting at the focused cell. Compatible with Excel/Sheets.
jumpTo
Parses a cell reference like AB2000, centers viewport, and moves cursor.
Views
spreadsheet.html.twig
Outer shell rendered on initial page load only. SSE updates are generated with raw PHP string building, yielding a 3 to 4× throughput improvement over Twig rendering on the hot path.