npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

phaser-ez

v0.0.219

Published

A streamlined library for Phaser3 game development.

Readme

Phaser-EZ

A streamlined library for Phaser 3 game development that eliminates boilerplate and accelerates game creation.

Phaser-EZ is a production-ready extension library built on top of Phaser 3, designed to simplify common game development patterns while maintaining full compatibility with the underlying Phaser API. Born from real-world game development needs, it provides intuitive abstractions for scene management, asset loading, and component architecture.

✨ Key Features

🎮 Smart Scene Management

  • DefaultScene: Enhanced base scene class with automatic asset loading
  • Intelligent Preloading: Automatic scene preloading for seamless transitions
  • Scene Flow Control: Sophisticated scene routing and state management
  • EventBus Integration: Global event system for cross-scene communication

📦 Automatic Asset Management

  • Context-Aware Loading: Assets automatically organized by scene directory structure
  • Multi-Format Support: Images, audio, video, sprites, and atlases
  • Base64 Support: Direct loading of embedded assets
  • Persistent Assets: Configure sounds and resources that persist across scenes
  • CDN Integration: Built-in support for CDN-delivered assets

🔧 Modern Development Experience

  • Vite Integration: Leverages modern bundler features like import.meta.glob
  • Vue.js Compatible: Seamless integration with Vue 3 applications
  • TypeScript Ready: Full TypeScript support for better developer experience
  • Hot Reload Friendly: Optimized for development workflows

🎯 Production Proven

  • Battle Tested: Used in production educational games with complex requirements
  • Performance Optimized: Efficient resource management and scene transitions
  • Extensible Architecture: Easy to extend with custom components and utilities
  • Component System: Reusable game components for buttons, UI elements, and interactions

🚀 Quick Start

Installation

npm install phaser-ez phaser
# or
pnpm add phaser-ez phaser

Basic Usage

import { Main, DefaultScene, Preloader, EventBus } from 'phaser-ez'
import Phaser from 'phaser-ez/Phaser'

// Create your game scenes
class GameScene extends DefaultScene {
  constructor() {
    super('GameScene')
  }
  
  start() {
    // Scene automatically loads assets from assets/images/GameScene/
    this.add.image(400, 300, 'background')
    
    // Preload next scene for seamless transitions
    DefaultScene.preload(this, 'NextScene')
  }
}

// Configure and start your game
const config = {
  type: Phaser.AUTO,
  width: 800,
  height: 600
}

// Set up asset contexts (works with Vite)
DefaultScene.imagesContext = import.meta.glob('./assets/images/**/*', { eager: true })
DefaultScene.soundsContext = import.meta.glob('./assets/sounds/**/*', { eager: true })

// Configure persistent assets
DefaultScene.persistentSounds = ['backgroundMusic']

// Start the game
const { game } = Main({
  config,
  scenes: { GameScene }
})

🏗️ Architecture

Scene Lifecycle

export default class MyScene extends DefaultScene {
  constructor() {
    super('MyScene')
  }
  
  start() {
    // Called when scene becomes active
    // Assets automatically loaded based on scene name
  }
  
  dispose() {
    // Clean up scene resources
    // Called automatically during scene transitions
  }
}

Asset Organization

src/assets/
├── sounds/
│   ├── MyScene/          # Auto-loaded for MyScene
│   │   ├── bgm.mp3
│   │   └── sfx.ogg
│   └── common/           # Shared across scenes
├── images/
│   ├── MyScene/
│   │   ├── background.png
│   │   ├── character_32x48.png    # Auto-detected spritesheet
│   │   └── ui_atlas.png           # Auto-detected atlas
│   └── common/
└── videos/

EventBus Communication

// Emit events from any scene
EventBus.emit('player-scored', { score: 100 })

// Listen for events in Vue components or other scenes
EventBus.on('player-scored', (data) => {
  console.log(`Player scored: ${data.score}`)
})

🎯 Real-World Usage

Phaser-EZ powers sophisticated educational games with features including:

  • Complex Scene Flows: Story sequences, interactive battles, character progression
  • Live2D Integration: Animated character interactions with dynamic asset loading
  • State Management: Seamless integration with Vue/Pinia for game state
  • Multi-Stage Games: Level progression with persistent data and scene preloading
  • Interactive UI Components: Reusable button systems, progress bars, and animated elements

📚 Documentation & Examples

🛠️ Development

# Install dependencies
npm install

# Build the library
npm run build

# Development mode with watch
npm run watch

# Run example project
cd example
npm install
npm run dev

🎮 Why Phaser-EZ?

Traditional Phaser 3 Development:

// Manual asset loading, scene management, cleanup...
class MyScene extends Phaser.Scene {
  preload() {
    this.load.image('bg', './assets/bg.png')
    this.load.audio('music', './assets/music.mp3')
    // ... manual loading for each asset
  }
  
  create() {
    // Manual scene setup
  }
}

With Phaser-EZ:

// Automatic asset loading, simplified scene management
class MyScene extends DefaultScene {
  start() {
    // Assets auto-loaded, just focus on game logic
    this.add.image(400, 300, 'bg')
    this.sound.play('music')
  }
}

🤝 Contributing

We welcome contributions! This library is actively maintained and used in production. To contribute:

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

📄 License

MIT License - see LICENSE for details.


Ready to streamline your Phaser 3 development? Phaser-EZ eliminates the boilerplate so you can focus on creating amazing games. 🎮✨