Installation
tilttek/table-presencecomposer require tilttek/table-presence
The package needs PHP 8.5 or later and psr/clock, whose clock gives the service the time.
An application gives Presence:
- a
Contract\PresenceStorethat keeps the tables in its database; - a PSR-20
ClockInterface, such as theNativeClockofsymfony/clock; - a
Contract\PresenceObserver, to send its messages, or nothing; - a
Contract\BlockList, when its members can block one another, or nothing.
The service keeps no state between calls, so one instance serves every request of a long-running worker.
An application also calls Presence::sweep() on each open table every few seconds — from a scheduled message, say —
so that the table hears who left.
Store\InMemoryPresenceStore keeps the tables in memory, for tests.