venzon/clank-bundle
venzon/clank-bundle is a Laravel/PHP package that bundles Clank integration for your application. It offers straightforward Composer-based setup, minimal configuration, and a lightweight way to add Clank support without extra boilerplate.
ClankBundle is a Symfony2 bundle, not a Laravel package, so "getting started" in a Laravel app really means deciding whether you are going to vendor the bundle or mine it for parts. First moves:
TopicManager, the RPC/periodic service abstractions, and the ClankServer console command that wraps Ratchet\Server\IoServer.cboden/ratchet ~0.3). Modern PHP 8 will usually install after adding "cboden/ratchet": "^0.4" in your root composer.json and allowing the bundle with --ignore-platform-reqs for the Symfony constraints, but expect friction.clank:server console command. The fastest sanity check is to clone the repo, point bin/console at a throwaway Symfony 2 skeleton, and confirm the Ratchet loop boots and accepts a socket.In Laravel terms, the equivalent day-one setup is: composer require cboden/ratchet directly, write an artisan clank:serve command modeled on the bundle's server command, and copy the TopicManager into app/WebSockets/.
The bundle's opinionated patterns are worth borrowing even if you never install it as a bundle.
ConnectionInterface collection behind a topic abstraction so controllers/services publish to topic:orders rather than iterating connections. Emit on subscribe, unsubscribe, and disconnect.WsRpcRegistry and resolved from the container.React\EventLoop\LoopInterface::addPeriodicTimer. Keep the callback short; it blocks the whole loop.$conn->Session->get('user_id') works. In Laravel you'd do the same by reading a signed token/handshake cookie in onOpen and storing identity on the connection object yourself.broadcast() event) so HTTP requests can nudge the WS loop. ClankBundle assumes in-process publishing; a multi-process setup needs an external bus.WebSocket + JSON envelopes) is fine; you're not locked into theirs.app/ so upstream abandonment doesn't block you.onClose. Log count($connections) periodically; a memory creep here is almost always a topic that never prunes.onMessage or a periodic timer stalls every connected client. Push heavy work to a queue (dispatch()->onQueue('ws')) and publish from the worker.Session after a token expires mid-connection.Ratchet\Server\IoServer logs to stderr by default; wire a Psr\Log implementation (Monolog) through the server command rather than echo. Use a raw wscat -c ws://localhost:8080 to isolate server bugs from JS bugs.onSubscribe, onUnsubscribe), the RPC dispatcher contract, and the periodic-service interface. Everything else is Symfony2 glue.cboden/ratchet directly, beyondcode/laravel-websockets (Pusher protocol, works with Laravel Echo), or moving to a managed service (Soketi, Pusher, Ably) is usually less work than reviving a dormant Symfony2 bundle in a Laravel codebase.artisan command — the container and kernel assumptions will fight you.How can I help you explore Laravel packages today?