phrity / websocket-graphql
WebSocket GraphQL server
1.1.0
2026-09-20 13:15 UTC
Requires
- php: ^8.1
- phrity/websocket: ^3.7 || ^4.0
- webonyx/graphql-php: ^15.0
Requires (Dev)
- phpstan/phpstan: ^2.0
- phpunit/phpunit: ^10.0 || ^11.0 || ^12.0 || ^13.0
- phrity/net-mock: ^2.4
- robiningelbrecht/phpunit-coverage-tools: ^1.9
- squizlabs/php_codesniffer: ^4.0
Suggests
None
Provides
None
Conflicts
None
Replaces
None
This package is auto-updated.
Last update: 2026-09-20 13:26:38 UTC
README
Websocket GraphQL Server for PHP
This library provides a GraphQL server over WebSocket.
It connects two popular and well developed libraries to achieve a competent and highly configurable server.
- phrity/websocket for WebSocket server
- webonyx/graphql-php for GraphQL API
Installing
Preferred way to install is with Composer.
composer require phrity/websocket-graphql
Setup
You only need to create a GraphQL server config and add it to the middleware provided by this library.
// Setup GraphQL server configuration with schema etc $serverConfig = GraphQL\Server\ServerConfig::create([ 'schema' => $schema, ]); // Setup WebSocket server with the GraphQL middleware $server = new WebSocket\Server($port, $ssl); $server ->addMiddleware(new WebSocket\Middleware\CloseHandler()) ->addMiddleware(new WebSocket\Middleware\PingResponder()) ->addMiddleware(new Phrity\WebSocket\GraphQL\Middleware($serverConfig)) ; // Run the server - the middleware will respond to requests $server->start();
