voryx/thruway-common
Shared common components for Thruway, the PHP WAMP (Web Application Messaging Protocol) client and router built on ReactPHP. Provides core protocol utilities and message handling used across Thruway packages for real-time pub/sub and RPC over WebSockets.
voryx/thruway-common as a protocol building block, not an application package. In most Laravel apps you will get it transitively via voryx/thruway; install it directly only if you are writing custom WAMP message handling, serializers, or tests against WAMP frames.
composer require voryx/thruway-common
vendor/voryx/thruway-common/src/:
Message/ — WAMP message classes and message-code mapping. Start with the base Message class and Message::createMessageFromArray().Role/ — WAMP role definitions (Caller, Callee, Publisher, Subscriber) and role feature negotiation.Serializer/ — JSON/MsgPack serialization helpers when present in your installed version.Logging/ — shared logger wiring used by Thruway components.use Thruway\Message\Message;
$parts = json_decode($rawWampFrame, true);
$message = Message::createMessageFromArray($parts);
dump(get_class($message), $message->getMessageParts());
voryx/thruway for the connection/session/client layer, then use this package’s message and role classes when you need to inspect, test, or customize behavior.config/wamp.php with realm, router URL, auth, and reconnect settings.CallMessage, ResultMessage, or ErrorMessage payloads.PublishMessage/EventMessage classes when testing or when building a custom router-side component, but let the client session handle normal subscribe/publish flows.Message::createMessageFromArray() heavily in unit tests. It lets you build realistic WAMP frames without a live router, which is useful for testing Laravel listeners, exception mapping, and auth failures.WelcomeMessage, use the role definitions to verify that caller/callee/publisher/subscriber features match what your client expects.voryx/thruway-common and voryx/thruway share the Thruway\ namespace; mismatched versions can produce confusing class/API differences. Check with:
composer show voryx/thruway-common
composer why voryx/thruway-common
jsonSerialize has a proper return type as of 1.0.6 for PHP 8.1+. If you were previously suppressing deprecation notices from the serializer on PHP 8.1+, upgrading removes those. Confirm the resolver picks 1.0.6+ before relying on that behavior.[], while WAMP expects {} for empty dicts. Use new \stdClass() or explicit JSON handling where the spec requires an object.dump($message->getMessageParts());
dump(get_class($message));
ErrorMessage is not a normal exception. It carries a WAMP error URI and arguments. Map these to domain exceptions in your Laravel integration instead of letting them leak into application code.How can I help you explore Laravel packages today?