{"id":13559404,"url":"https://github.com/proyecto26/ion-phaser","last_synced_at":"2026-03-16T09:05:49.730Z","repository":{"id":34917877,"uuid":"189879524","full_name":"proyecto26/ion-phaser","owner":"proyecto26","description":"A web component to use Phaser Framework with Angular, React, Vue, etc 🎮","archived":false,"fork":false,"pushed_at":"2024-10-27T16:06:37.000Z","size":1080,"stargazers_count":252,"open_issues_count":13,"forks_count":37,"subscribers_count":7,"default_branch":"develop","last_synced_at":"2025-05-11T13:39:52.358Z","etag":null,"topics":["angular","custom-component","custom-components","custom-elements","ionic","ionic-framework","phaser","phaser-framework","phaser3","phaserjs","react","react-component","stencil-components","stencil-js","stenciljs","stenciljs-components","vue","vuejs","web-component","web-components"],"latest_commit_sha":null,"homepage":"https://market.ionicframework.com/plugins/ionphaser","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/proyecto26.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"jdnichollsc","patreon":"proyecto26","open_collective":"proyecto26","ko_fi":"proyecto26","liberapay":"proyecto26","donorbox":"proyecto-26","custom":["paypal.me/jdnichollsc","buymeacoffee.com/jdnichollsc","donorbox.org/proyecto-26"]}},"created_at":"2019-06-02T18:11:54.000Z","updated_at":"2025-03-22T05:03:24.000Z","dependencies_parsed_at":"2024-11-13T19:32:43.163Z","dependency_job_id":"c38a12e8-cb19-4ba9-a462-980d2cabd72f","html_url":"https://github.com/proyecto26/ion-phaser","commit_stats":{"total_commits":70,"total_committers":1,"mean_commits":70.0,"dds":0.0,"last_synced_commit":"838131f7b3a5b1467114d01260113c94a43d295d"},"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/proyecto26%2Fion-phaser","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/proyecto26%2Fion-phaser/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/proyecto26%2Fion-phaser/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/proyecto26%2Fion-phaser/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/proyecto26","download_url":"https://codeload.github.com/proyecto26/ion-phaser/tar.gz/refs/heads/develop","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254384937,"owners_count":22062421,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["angular","custom-component","custom-components","custom-elements","ionic","ionic-framework","phaser","phaser-framework","phaser3","phaserjs","react","react-component","stencil-components","stencil-js","stenciljs","stenciljs-components","vue","vuejs","web-component","web-components"],"created_at":"2024-08-01T13:00:21.135Z","updated_at":"2026-03-16T09:05:49.700Z","avatar_url":"https://github.com/proyecto26.png","language":"TypeScript","readme":"![Built With Stencil](https://img.shields.io/badge/-Built%20With%20Stencil-16161d.svg?logo=data%3Aimage%2Fsvg%2Bxml%3Bbase64%2CPD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4KPCEtLSBHZW5lcmF0b3I6IEFkb2JlIElsbHVzdHJhdG9yIDE5LjIuMSwgU1ZHIEV4cG9ydCBQbHVnLUluIC4gU1ZHIFZlcnNpb246IDYuMDAgQnVpbGQgMCkgIC0tPgo8c3ZnIHZlcnNpb249IjEuMSIgaWQ9IkxheWVyXzEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHg9IjBweCIgeT0iMHB4IgoJIHZpZXdCb3g9IjAgMCA1MTIgNTEyIiBzdHlsZT0iZW5hYmxlLWJhY2tncm91bmQ6bmV3IDAgMCA1MTIgNTEyOyIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI%2BCjxzdHlsZSB0eXBlPSJ0ZXh0L2NzcyI%2BCgkuc3Qwe2ZpbGw6I0ZGRkZGRjt9Cjwvc3R5bGU%2BCjxwYXRoIGNsYXNzPSJzdDAiIGQ9Ik00MjQuNywzNzMuOWMwLDM3LjYtNTUuMSw2OC42LTkyLjcsNjguNkgxODAuNGMtMzcuOSwwLTkyLjctMzAuNy05Mi43LTY4LjZ2LTMuNmgzMzYuOVYzNzMuOXoiLz4KPHBhdGggY2xhc3M9InN0MCIgZD0iTTQyNC43LDI5Mi4xSDE4MC40Yy0zNy42LDAtOTIuNy0zMS05Mi43LTY4LjZ2LTMuNkgzMzJjMzcuNiwwLDkyLjcsMzEsOTIuNyw2OC42VjI5Mi4xeiIvPgo8cGF0aCBjbGFzcz0ic3QwIiBkPSJNNDI0LjcsMTQxLjdIODcuN3YtMy42YzAtMzcuNiw1NC44LTY4LjYsOTIuNy02OC42SDMzMmMzNy45LDAsOTIuNywzMC43LDkyLjcsNjguNlYxNDEuN3oiLz4KPC9zdmc%2BCg%3D%3D\u0026colorA=16161d\u0026style=flat-square)\n[![Maintenance](https://img.shields.io/badge/Maintained%3F-yes-brightgreen.svg)](https://github.com/proyecto26/ion-phaser/graphs/commit-activity)\n[![NPM version][npm-image]][npm-url]\n[![Downloads][downloads-image]][npm-url]\n[![TotalDownloads][total-downloads-image]][npm-url]\n[![Twitter Follow][twitter-image]][twitter-url]\n\n[npm-image]:http://img.shields.io/npm/v/@ion-phaser/core.svg\n[npm-url]:https://npmjs.org/package/@ion-phaser/core\n[downloads-image]:http://img.shields.io/npm/dm/@ion-phaser/core.svg\n[total-downloads-image]:http://img.shields.io/npm/dt/@ion-phaser/core.svg?label=total%20downloads\n[twitter-image]:https://img.shields.io/twitter/follow/jdnichollsc.svg?style=social\u0026label=Follow%20me\n[twitter-url]:https://twitter.com/jdnichollsc\n\n\n# IonPhaser\nWeb Component built with **[Stencil.js](https://github.com/ionic-team/stencil)** to integrate **[Phaser](https://github.com/photonstorm/phaser)** with any other framework.\n\u003cp align=\"center\"\u003e\n  \u003cimg width=\"600px\" alt=\"IonPhaser\" src=\"./img/ionphaser.jpg\"\u003e\n\u003c/p\u003e\n\u003cp align=\"center\"\u003eInspired by the old \u003ca href=\"https://github.com/jdnichollsc/IonPhaser\"\u003eIonPhaser directive\u003c/a\u003e\u003c/p\u003e\n\n## Demo\n\nDo you want to see this web component in action? Visit https://codepen.io/jdnichollsc/full/oRrwKM yay! 🎉\n\n- Web Camera: https://codepen.io/jdnichollsc/full/YzQWEwz\n\n## IonPhaser CE\nLooking for [Phaser Framework CE (Community Edition)](https://github.com/photonstorm/phaser-ce)? Check [here](https://github.com/proyecto26/ion-phaser-ce)!\n\n## Usage\nSimply add this tag wherever you want in your project:\n- [ion-phaser](./src/components/ion-phaser/readme.md)\n```html\n\u003cion-phaser [game]=\"game\"\u003e\u003c/ion-phaser\u003e\n```\n\n## Getting Started\n\n### Packages\n\n| Project | Package | Version | Links |\n| ------- | ------- | ------- |:-----:|\n| **Core** | [`@ion-phaser/core`](https://www.npmjs.com/package/@ion-phaser/core) | [![version](https://img.shields.io/npm/v/@ion-phaser/core/latest.svg)](https://www.npmjs.com/package/@ion-phaser/core) | [`README.md`](./README.md)\n| **React** | [`@ion-phaser/react`](https://www.npmjs.com/package/@ion-phaser/react) | [![version](https://img.shields.io/npm/v/@ion-phaser/react/latest.svg)](https://www.npmjs.com/package/@ion-phaser/react) | [`README.md`](react/README.md)\n\n### Script tag\n\n- Put a script tag similar to this `\u003cscript src='https://cdn.jsdelivr.net/npm/@ion-phaser/core@1.3.0/dist/ionphaser/ionphaser.esm.js'\u003e\u003c/script\u003e` in the head of your index.html\n- Then you can use the element anywhere in your template, JSX, html etc\n\n### Node Modules\n- Run `npm install @ion-phaser/core --save`\n- Put a script tag similar to this `\u003cscript src='node_modules/@ion-phaser/core/dist/ionphaser/ionphaser.esm.js'\u003e\u003c/script\u003e` in the head of your index.html\n- Then you can use the element anywhere in your template, JSX, html etc\n\n### In a stencil-starter app\n- Run `npm install @ion-phaser/core --save`\n- Add an import to the npm packages `import @ion-phaser/core;`\n- Then you can use the element anywhere in your template, JSX, html etc\n\n# Framework integrations\n\n## Angular\n\nUsing `ion-phaser` component within an Angular project:\n\n### Including the Custom Elements Schema\n\nIncluding the `CUSTOM_ELEMENTS_SCHEMA` in the module allows the use of Web Components in the HTML files. Here is an example of adding it to `AppModule`:\n\n```ts\nimport { BrowserModule } from '@angular/platform-browser';\nimport { CUSTOM_ELEMENTS_SCHEMA, NgModule } from '@angular/core';\nimport { AppComponent } from './app.component';\n\n@NgModule({\n  declarations: [AppComponent],\n  imports: [BrowserModule],\n  bootstrap: [AppComponent],\n  schemas: [CUSTOM_ELEMENTS_SCHEMA]\n})\nexport class AppModule {}\n```\n\nThe `CUSTOM_ELEMENTS_SCHEMA` needs to be included in any module that uses **IonPhaser**.\n\n### Calling defineCustomElements\n\n**IonPhaser** component includes a function used to load itself in the application window object. That function is called `defineCustomElements()` and needs to be executed once during the bootstrapping of your application. One convenient place to add it is in the `main.ts` file as follows:\n\n```tsx\nimport { enableProdMode } from '@angular/core';\nimport { platformBrowserDynamic } from '@angular/platform-browser-dynamic';\nimport { defineCustomElements as defineIonPhaser } from '@ion-phaser/core/loader';\n\nimport { AppModule } from './app/app.module';\nimport { environment } from './environments/environment';\n\nif (environment.production) {\n  enableProdMode();\n}\n\nplatformBrowserDynamic().bootstrapModule(AppModule)\n  .catch(err =\u003e console.log(err));\ndefineIonPhaser(window);\n```\n\n### Using IonPhaser in an Angular component\n\n```html\n\u003cion-phaser\n  [game]=\"game\"\n  [initialize]=\"initialize\"\n\u003e\u003c/ion-phaser\u003e\n```\n\n```ts\npublic game = {\n  width?: integer | string;\n  height?: integer | string;\n  zoom?: number;\n  resolution?: number;\n  type?: number;\n  parent: HTMLElement | string;\n  canvas?: HTMLCanvasElement;\n  canvasStyle?: string;\n  context?: CanvasRenderingContext2D;\n  scene?: object;\n  seed?: string[];\n  title?: string;\n  url?: string;\n  version?: string;\n  autoFocus?: boolean;\n  input?: boolean | InputConfig;\n  disableContextMenu?: boolean;\n  banner?: boolean | BannerConfig;\n  dom?: DOMContainerConfig;\n  fps?: FPSConfig;\n  render?: RenderConfig;\n  backgroundColor?: string | number;\n  callbacks?: CallbacksConfig;\n  loader?: LoaderConfig;\n  images?: ImagesConfig;\n  physics?: object;\n  plugins?: PluginObject | PluginObjectItem[];\n  scale?: ScaleConfig;,\n  instance: Game // It's created internally when the game is initialized\n};\n\npublic initialize: boolean;\n\nconstructor(private api : ApiService){}\n\ninitializeGame() {\n  this.game = {\n    width: \"100%\",\n    height: \"100%\",\n    type: Phaser.AUTO,\n    scene: {}\n  }\n  this.initialize = true\n}\n\ngetInstance(){\n  return this.game.instance\n}\n```\n\n[_from stencil documentation_](https://github.com/ionic-team/stencil-site/blob/master/src/docs/framework-integration/angular.md)\n\n## React\n\n### Specific Wrapper\nWhen using a wrapper component, It's not necessary to access the reference directly to configure the game. More details [here](./react/README.md).\n```tsx\nimport React, { Component } from 'react'\nimport Phaser from 'phaser'\nimport { IonPhaser } from '@ion-phaser/react'\n\nclass App extends Component {\n  state = {\n    initialize: false,\n    game: {\n      width: \"100%\",\n      height: \"100%\",\n      type: Phaser.AUTO,\n      scene: {}\n    }\n  }\n  render() {\n    const { initialize, game } = this.state\n    return (\n      \u003cIonPhaser game={game} initialize={initialize} /\u003e\n    )\n  }\n}\n```\n\n### Web Component\nOther option is using the web component directly: \n\n```tsx\nimport React from 'react'\nimport ReactDOM from 'react-dom'\nimport { defineCustomElements as defineIonPhaser } from '@ion-phaser/core/loader'\nimport Phaser from 'phaser'\n\nconst game = {\n  width: \"100%\",\n  height: \"100%\",\n  type: Phaser.AUTO,\n  scene: {}\n}\n\nReactDOM.render(\u003cion-phaser ref={el =\u003e el.game = game} /\u003e, document.getElementById('root'));\n\ndefineIonPhaser(window);\n```\n\n[_from stencil documentation_](https://github.com/ionic-team/stencil-site/blob/master/src/docs/framework-integration/react.md)\n\n## Vue\n\nIn order to use the `ion-phaser` Web Component inside of a Vue application, it should be modified to define the custom elements and to inform the Vue compiler which elements to ignore during compilation. This can all be done within the `main.js` file as follows:\n\n```tsx\nimport Vue from 'vue';\nimport { defineCustomElements as defineIonPhaser } from '@ion-phaser/core/loader'\n\nimport App from './App.vue';\n\nVue.config.productionTip = false;\nVue.config.ignoredElements = [/ion-\\w*/];\n\n// Bind the IonPhaser custom element to the window object\ndefineIonPhaser(window);\n\nnew Vue({\n  render: h =\u003e h(App)\n}).$mount('#app');\n```\n\n### Using IonPhaser in a Vue component\n\n```vue\n\u003ctemplate\u003e\n  \u003cion-phaser \n    v-bind:game.prop=\"game\"\n    v-bind:initialize.prop=\"initialize\"\n  /\u003e\n\u003c/template\u003e\n\n\u003cscript\u003e\nimport Phaser from 'phaser'\nexport default {\n  name: 'HelloWorld',\n  data() {\n    return {\n      initialize: false,\n      game: {\n        width: \"100%\",\n        height: \"100%\",\n        type: Phaser.AUTO,\n        scene: {\n          init: function() {\n            this.cameras.main.setBackgroundColor('#24252A')\n          },\n          create: function() {\n            this.helloWorld = this.add.text(\n              this.cameras.main.centerX, \n              this.cameras.main.centerY, \n              \"Hello World\", { \n                font: \"40px Arial\", \n                fill: \"#ffffff\" \n              }\n            );\n            this.helloWorld.setOrigin(0.5);\n          },\n          update: function() {\n            this.helloWorld.angle += 1;\n          }\n        }\n      }\n    }\n  }\n}\n\u003c/script\u003e\n```\n\n[_from stencil documentation_](https://github.com/ionic-team/stencil-site/blob/master/src/docs/framework-integration/vue.md)\n\n## Contributing ✨\nWhen contributing to this repository, please first discuss the change you wish to make via issue, email, or any other method with the owners of this repository before making a change.  \nContributions are what make the open-source community such an amazing place to learn, inspire, and create. Any contributions you make are **greatly appreciated** ❤️.  \nYou can learn more about how you can contribute to this project in the [contribution guide](https://github.com/proyecto26/ion-phaser/blob/develop/CONTRIBUTING.md).\n\n## Supporting 🍻\nI believe in Unicorns 🦄\nSupport [me](http://www.paypal.me/jdnichollsc/2), if you do too.\n\nDonate **Ethereum**, **ADA**, **BNB**, **SHIBA**, **USDT/USDC**, **DOGE**, etc:\n\n\u003e Wallet address: jdnichollsc.eth\n\nPlease let us know your contributions! 🙏\n\n## Enterprise 💼\n\nAvailable as part of the Tidelift Subscription.\n\nThe maintainers of IonPhaser and thousands of other packages are working with Tidelift to deliver commercial support and maintenance for the open source dependencies you use to build your applications. Save time, reduce risk, and improve code health, while paying the maintainers of the exact dependencies you use. [Learn more.](https://tidelift.com/subscription/pkg/npm-ion-phaser-core?utm_source=npm-ion-phaser-core\u0026utm_medium=referral\u0026utm_campaign=enterprise\u0026utm_term=repo)\n\n## Security contact information 🚨\nTo report a security vulnerability, please use the [Tidelift security contact](https://tidelift.com/security). Tidelift will coordinate the fix and disclosure.\n\n## License ⚖️\nThis repository is available under the [MIT License](https://github.com/proyecto26/ion-phaser/blob/develop/LICENSE).\n\n## Happy coding 💯\nMade with ❤️\n\n\u003cimg width=\"150px\" src=\"https://avatars0.githubusercontent.com/u/28855608?s=200\u0026v=4\" align=\"right\"\u003e\n","funding_links":["https://github.com/sponsors/jdnichollsc","https://patreon.com/proyecto26","https://opencollective.com/proyecto26","https://ko-fi.com/proyecto26","https://liberapay.com/proyecto26","proyecto-26","paypal.me/jdnichollsc","buymeacoffee.com/jdnichollsc","donorbox.org/proyecto-26","http://www.paypal.me/jdnichollsc/2","https://tidelift.com/subscription/pkg/npm-ion-phaser-core?utm_source=npm-ion-phaser-core\u0026utm_medium=referral\u0026utm_campaign=enterprise\u0026utm_term=repo","https://tidelift.com/security"],"categories":["Uncategorized","Ecosystem Highlights"],"sub_categories":["Uncategorized","Data \u0026 Visualization"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fproyecto26%2Fion-phaser","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fproyecto26%2Fion-phaser","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fproyecto26%2Fion-phaser/lists"}