Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Phpws Laravel Package

mpociot/phpws

mpociot/phpws is a lightweight, event-driven WebSocket server for PHP built on ReactPHP. Simple onOpen, onMessage, and onClose callbacks make it easy to add real-time features like chat, notifications, and live updates to your apps.

View on GitHub
Deep Wiki
Context7

WebSocket Server and Client library for PHP

Frequently asked questions about Phpws
Is mpociot/phpws still maintained for Laravel projects?
mpociot/phpws has not had a release since May 2019 and has very little ecosystem signal, so treat it as unmaintained rather than production-ready. There are no security patches or current PHP 8.x guarantees, and any socket, TLS, or event-loop vulnerability becomes your team's responsibility. It can be useful as a spike or reference implementation, but it should not be a production default for a Laravel app without a funded fork-and-maintain plan.
Can I use mpociot/phpws as a Laravel WebSocket server?
Not natively. mpociot/phpws is a framework-agnostic ReactPHP WebSocket server and client, so it ships no Laravel service provider, broadcasting driver, config file, or route integration. You can run it beside Laravel as a standalone daemon, but you must own the artisan command, process supervision, TLS proxy, handshake authentication, and channel authorization glue yourself.
How do I install and configure mpociot/phpws with Composer?
Install it with Composer using composer require mpociot/phpws, then expect to write your own bootstrap script or artisan command because there is no Laravel auto-discovery or publishable configuration. Check dependency resolution against your current Laravel lockfile first, since its ReactPHP-era constraints may conflict with modern packages. If Composer cannot resolve cleanly, stop and run a bounded spike rather than forcing versions in production.
Does mpociot/phpws support Laravel 10, Laravel 11, PHP 8, and Octane?
There is no official Laravel version matrix for mpociot/phpws, and it predates current Laravel and Octane stacks. PHP 8.x compatibility and coexistence with Octane are not guaranteed, so verify installation against your exact lockfile before committing. In practice, dependency conflicts with modern ReactPHP constraints are a likely blocker.
How do I authenticate WebSocket connections with mpociot/phpws in Laravel?
You must implement handshake authentication yourself inside the onOpen callback, such as verifying a session cookie or JWT before accepting the connection. There is no Laravel middleware pipeline to reuse for the WebSocket handshake, and channel subscription authorization is also custom work. Plan for explicit authorization checks per channel and a clear revocation strategy.
Can mpociot/phpws broadcast Laravel events or notifications to clients?
No broadcasting integration is included. Laravel events and notifications do not automatically reach mpociot/phpws; the canonical pattern is to publish domain events to Redis and have the standalone WebSocket daemon subscribe and fan out messages. That bridge, payload format, retry behavior, and authorization model are all bespoke code you must design and test.
What are the best alternatives to mpociot/phpws for Laravel real-time features?
For Laravel teams, Laravel Reverb is the first-party WebSocket server to evaluate, while managed services like Pusher or Ably remove daemon operations entirely. If the product only needs occasional browser updates, SSE or polling may deliver the outcome with less operational risk. Choose mpociot/phpws only when a real persistent socket tier is mandatory and the team accepts a second runtime.
How do I run and supervise a mpociot/phpws daemon in production?
Run it as a long-lived daemon under systemd or Supervisor with restart and backoff policy, and put a TLS-terminating reverse proxy in front of it. Because it is outside PHP-FPM, you need monitoring, logging, health checks, and an on-call owner for the process. Also avoid blocking calls inside handlers, since a synchronous database query or HTTP request stalls all connections on the event loop.
Does mpociot/phpws scale across multiple WebSocket nodes?
mpociot/phpws has no clustering story. It runs as a single-threaded event-loop daemon, and the package does not provide multi-node coordination or presence synchronization. If you need horizontal scale at launch, plan for Redis pub/sub and sticky sessions or choose a platform with clustering built in.
How should I test mpociot/phpws before using it in a Laravel app?
Start with a one-to-two-week bounded spike that proves Composer resolution, handshake auth, one channel authorization rule, and a supervised daemon behind TLS. Unit-test your message handlers separately and run an integration test with a real WebSocket client, including a blocking-call scenario to expose event-loop stalls. Do not schedule production traffic until you have a named owner and budget for fork maintenance.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
robertmarney/lara-hierarchial-collections
simonschaufi/rule-doc-generator
emissaoja/emissaoja
blackbricksoftware/gravityforms-civicrm-form-processor
al-rahabi/fancy-crud
jinas/dhivatar-component
mltstephane/laravel-quality
bernskiold/laravel-talentlms
bernskioldmedia/laravel-form-architect
youbar/easy-crud
c-point-labs/laravel-hostyourai
dbravoan/dbcms-admin-theme-dbcms
dbravoan/dbcms-theme-db-cyber
dbravoan/dbcms-blocks-basic
dbravoan/dbcms-module-content-audit
dbravoan/dbcms-module-ai-assistant
paygate-to/paygate-php
padosoft/askmydocs-connector-base
defstudio/supercharged-carbon
bernskioldmedia/laravel-matomo