@kbve/laser
v0.1.0
Published
Phaser + React Three Fiber integration layer for React 19
Maintainers
Readme
Laser
Laser is a lightweight integration layer for Phaser and React Three Fiber in React 19 applications. It provides React hooks and components for embedding Phaser games and R3F scenes with a shared event bus, making it easy to build hybrid 2D/3D game UIs.
Features
- Phaser integration —
<PhaserGame>component with ref-based access,usePhaserGamecontext hook, andusePhaserEventfor subscribing to Phaser events - React Three Fiber integration —
<Stage>component anduseGameLoophook for frame-synced game logic - Shared event bus —
LaserEventBusfor decoupled communication between Phaser and R3F layers - TypeScript-first — Full type definitions with exported types for configs, events, and geometry primitives
Install
npm install @kbve/laserPeer Dependencies
Laser requires the following peer dependencies (install the ones you need):
react>= 18.0.0react-dom>= 18.0.0phaser>= 3.80.0 (optional — only needed for Phaser features)three>= 0.160.0 (optional — only needed for R3F features)@react-three/fiber>= 9.0.0 (optional)@react-three/drei>= 10.0.0 (optional)
Usage
import {
PhaserGame,
usePhaserEvent,
Stage,
useGameLoop,
laserEvents,
} from '@kbve/laser';Support
For questions or help, reach out via our Discord server.
License
MIT
