codemonster-ru / ssr-bridge
A universal PHP bridge for interacting with Node.js SSR services (locally or via HTTP).
v2.0.0
2025-09-28 07:00 UTC
Requires
- php: >=8.2
Requires (Dev)
- phpunit/phpunit: ^9.6 || ^10.5 || ^11.0 || ^12.0
README
A universal PHP bridge for interacting with Node.js SSR services.
๐ฆ Installation
composer require codemonster-ru/ssr-bridge
๐ Usage
use Codemonster\Ssr\SsrBridge; // Local mode (Node.js runs directly) $bridge = new SsrBridge('local', null, __DIR__.'/../node_modules/ssr-service/dist/ssr.js'); $html = $bridge->render('Home', ['message' => 'Hello']); // HTTP mode (connecting to the remote SSR API) $bridge = new SsrBridge('http', 'http://127.0.0.1:3000'); $html = $bridge->render('Home', ['message' => 'Hello']);
โจ Features
- Local SSR execution via the
nodeprocess - Connection to a remote HTTP SSR server API
- Easy integration into any PHP project (Laravel, Symfony, Annabel, etc.)
๐งช Testing
You can run tests with the command:
composer test