← All open source projects

Phaser

phaserjs/phaser

Phaser is a JavaScript framework for 2D browser games with Canvas and WebGL rendering.

Forks 7,145
Author phaserjs
Language JavaScript
License MIT
Synced 2026-06-27

What it is

Phaser is a framework for building 2D browser games. It supports Canvas and WebGL, runs on desktop and mobile browsers, and provides scenes, sprites, physics, input, sound, asset loading, and the game loop.

It became popular because web games need a lot of repeated infrastructure: loaders, update loops, collisions, and input handling.

How the approach works

A Phaser game is usually split into scenes. A scene has preload for assets, create for objects, and update for per-frame logic.

Phaser 4 continues to evolve rendering and architecture, but the basic idea remains: help JavaScript developers get from idea to playable prototype quickly.

Minimal scene

This example shows the basic Phaser scene shape: load an asset, create an object, and update it every frame.

Language: JavaScript
class GameScene extends Phaser.Scene {
  preload() {
    this.load.image("player", "/player.png");
  }

  create() {
    this.player = this.add.sprite(120, 160, "player");
  }

  update() {
    this.player.x += 1;
  }
}

What is inside

The repository contains the engine, examples, documentation, changelog, rendering systems, game objects, input, sound, physics, and build infrastructure.

Phaser fits arcades, puzzles, learning games, interactive scenes, and prototypes where 2D is the right model.

Practical context

With Phaser, assets matter early: sprite sizes, atlases, sound, loading, and mobile performance quickly affect the feel of the game.

The framework speeds up mechanics, but level design, balance, controls, and fun remain the author’s work.

Why it matters for browser games

Phaser provides a ready layer for 2D browser games: scenes, sprites, input, sound, cameras, physics, and asset loading. Without it, a developer would rebuild a lot of game infrastructure on top of Canvas or WebGL.

It is often chosen for arcade games, educational games, prototypes, interactive campaigns, and small commercial projects. It stays close to the web platform while hiding routine game-loop details.

The limitation is clear: Phaser is not a universal engine for 3D or very large scene-heavy projects. If a project needs complex three-dimensional graphics or a full level editor like larger engines provide, another tool may fit better.

The repository’s strength is practicality. Game code can be written in JavaScript or TypeScript, run in the browser, be embedded into a site, and show results quickly without a separate user installation.

Strengths and limits

The strength is fast 2D browser-game development. The limit is that complex 3D projects and native consoles need other engines and pipelines.