# Phaser — card for AI agents

Fast, free HTML5 game framework for building 2D games for desktop and mobile.

Category: Game development · npm package `phaser` · latest version 4.2.1 (checked 2026-11-01)
Install: `npm install phaser`
License: MIT (permissive)

In your own product (generator, app, hosted service): **yes**. Permissive license: ship it inside your own product, closed or open source, and keep its license and copyright notice.

## Rules for AI agents (paste into AGENTS.md or CLAUDE.md)

## Phaser
- Install with `npm install phaser` and import with `import Phaser from 'phaser';`. In TypeScript, add `"typeRoots": ["./node_modules/phaser/types"]` and `"types": ["Phaser"]` to `tsconfig.json` if the editor does not detect the definitions.
- For new projects, scaffold with `npm create @phaserjs/game@latest`. For first-time users, the docs recommend the options Web Bundler and then Vite.
- When porting Phaser 3 code, use the `v3-to-v4-migration` skill and the Migration Guide. Do not use the removed classes `Point`, `Mesh` and `BitmapMask`. FX and Masks are now Filters.
- In v4, enable lighting with `sprite.setLighting(true)` and set tint behaviour with `setTintMode()`.
- Serve the game over `http://` from a local web server during development. Do not open the HTML via `file://`.
- Keep features 2D. Phaser has no built-in 3D rendering or 3D physics.
- For very large sprite counts use `SpriteGPULayer`. For large tilemaps use `TilemapGPULayer`.

## Agent Skills for it
- phaser-arcade-physics from gamedev-skills/awesome-gamedev-agent-skills: `npx skills add gamedev-skills/awesome-gamedev-agent-skills --skill phaser-arcade-physics`

## What it is
- Phaser is an open source HTML5 game framework for 2D games in desktop and mobile web browsers. It renders with WebGL or Canvas. The repository dates from April 2013 and is MIT licensed. Phaser Studio Inc develops it commercially, together with its community.
- You write games in JavaScript or TypeScript. Install from npm with `npm install phaser`, or load it from jsDelivr or cdnjs. The `create-phaser-game` CLI downloads official templates for front-end frameworks and bundlers. Phaser 4 replaced the whole v3 rendering pipeline with a node-based WebGL renderer. The README says the public API stays "mostly familiar".
- The README lists the targets: the web, YouTube Playables, Discord Activities, Reddit games and Twitch Overlays. iOS, Android, Steam and native apps go through third-party tools. The getting-started tutorial says the web remains the main focus, and that you develop against a local web server.

## Caveats
- 2D only: The getting-started tutorial says Phaser is a 2D framework. It says 3D needs third-party libraries, and that the documentation and examples reflect 2D.
- You need a local web server: The tutorial says you cannot simply drag the HTML file into a browser. Files opened that way use `file://`, which it calls "massively restricted". A game has to load images, audio and JSON.
- Native and Steam builds are third-party: The README says iOS, Android, Steam and native apps are reached "using 3rd party tools". Phaser itself builds for the browser.
- Phaser 3 code needs migration work: Phaser 4 keeps most of the public API, but the README names breaking areas and removed classes. It points to a Migration Guide with a checklist.
- Much learning material is v3-era: The free 500-page book <em>Phaser by Example</em> covers Phaser v3.80. The two starter tutorials linked from the README sit at URLs named for Phaser 3, and the first opens as "Getting Started with Phaser 3". Expect to adjust for the v4 changes.

## Numbers (AgentGid data)
- Gid Score: 70.8 (#351 of all tools, 1 of 8 in its category)
- Used in 12 public projects set up for AI coding agents (0.2%)
- Downloads last week: 778,231 (as of 2026-11-24), +56.4% over 4 weeks
- GitHub stars: 40,777 (as of 2026-11-24)
- Last push: 2026-08-21

## Often used with
Vite 45.6%, webpack 24.4%, webpack CLI 20.9%, webpack-dev-server 18.9%, html-webpack-plugin 17.2%, TypeScript 60.9%

## Links
- AgentGid page: https://agentgid.com/tools/phaser/
- Homepage: https://phaser.io
- Repository: https://github.com/phaserjs/phaser
- Source: https://github.com/phaserjs/phaser#readme
- Source: https://github.com/phaserjs/phaser
- Source: https://github.com/phaserjs/phaser/releases
- Source: https://phaser.io/tutorials/create-game-app
- Source: https://phaser.io/tutorials/getting-started-phaser3
- Source: https://phaser.io/news/2024/04/phaser-by-example-book

---
AgentGid's catalog is curated: every entry was checked against the maker's official pages (registry, repository, license and pricing pages) on the date shown; a license value shows the quote it stands on wherever AgentGid has one. Usage numbers come from AgentGid's own scan of public repositories set up for AI coding agents. Claims by makers are reported, not tested by AgentGid.
