{"id":25174,"library":"dk-elephize","title":"Elephize","description":"Elephize is a TypeScript-to-PHP transpiler designed for server-side rendering of React components. The current stable version is 3.1.3, while 4.0.0-alpha.13 is available as a pre-release. It transpiles a limited set of React and TypeScript constructs into PHP, targeting VKCOM's ecosystem. Key differentiators include direct PHP output for SSR, dependency on TypeScript 5.x, and a CLI tool for batch processing. However, it has sparse documentation in English and is primarily maintained for internal use.","status":"active","version":"4.0.0-alpha.13","language":"javascript","source_language":"en","source_url":"https://github.com/VKCOM/elephize","tags":["javascript","js","php","typescript"],"install":[{"cmd":"npm install dk-elephize","lang":"bash","label":"npm"},{"cmd":"yarn add dk-elephize","lang":"bash","label":"yarn"},{"cmd":"pnpm add dk-elephize","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Required peer dependency for transpilation","package":"typescript","optional":false}],"imports":[{"note":"ESM-only package; CommonJS require will fail.","wrong":"const elephize = require('@vkontakte/elephize')","symbol":"elephize","correct":"import elephize from '@vkontakte/elephize'"},{"note":"Named export 'transpile' is the primary function; default export is the whole module.","wrong":"import transpile from '@vkontakte/elephize'","symbol":"transpile","correct":"import { transpile } from '@vkontakte/elephize'"},{"note":"Type-only import; only available in TypeScript.","wrong":"","symbol":"ElephizeOptions","correct":"import type { ElephizeOptions } from '@vkontakte/elephize'"}],"quickstart":{"code":"import { transpile } from '@vkontakte/elephize';\n\nconst sourceCode = `\n  const App = () => {\n    return <div>Hello World</div>;\n  };\n  export default App;\n`;\n\nconst options = {\n  filename: 'App.tsx',\n  target: 'php',\n  ssr: true\n};\n\ntranspile(sourceCode, options).then(result => {\n  console.log(result.code);\n}).catch(err => {\n  console.error(err);\n});","lang":"typescript","description":"Shows basic usage of the transpile function to convert a React component to PHP."},"warnings":[{"fix":"Install TypeScript 5.x: npm install -D typescript@^5.0.2","message":"Peer dependency TypeScript ^5.0.2 required.","severity":"breaking","affected_versions":">=3.0.0"},{"fix":"Use latest stable 3.x for production.","message":"Version 4.x is in alpha; API may change.","severity":"deprecated","affected_versions":"4.0.0-alpha.x"},{"fix":"Review documentation for supported syntax before using.","message":"Only a limited subset of React and TypeScript is supported (e.g., no hooks, no JSX spread).","severity":"gotcha","affected_versions":"all"},{"fix":"Use import syntax; do not use require().","message":"No CommonJS support; ESM only.","severity":"gotcha","affected_versions":">=3.x"},{"fix":"Always await or chain promises.","message":"The transpile function is async; must be awaited or handled with .then().","severity":"gotcha","affected_versions":"all"}],"env_vars":null,"search_vec":"'3.1.3':24 '4.0.0':26 '5':62 'alpha.13':27 'avail':29 'batch':69 'cli':66 'compon':18 'construct':44 'current':20 'depend':59 'design':10 'differenti':52 'direct':54 'document':75 'ecosystem':50 'eleph':1,2 'english':77 'howev':71 'includ':53 'intern':83 'javascript':85 'js':86 'key':51 'limit':38 'maintain':81 'output':56 'php':8,46,55,87 'pre':33 'pre-releas':32 'primarili':80 'process':70 'react':17,41 'releas':34 'render':15 'server':13 'server-sid':12 'set':39 'side':14 'spars':74 'ssr':58 'stabl':21 'target':47 'tool':67 'transpil':9,36 'typescript':6,43,61,88 'typescript-to-php':5 'use':84 'version':22 'vkcom':48 'x':63","created_at":"2026-05-01T13:43:23.425764+00:00","updated_at":"2026-05-01T13:43:23.425764+00:00","problems":[{"fix":"Run npm install @vkontakte/elephize","cause":"Missing dependency or wrong import path.","error":"Cannot find module '@vkontakte/elephize'"},{"fix":"Use import { transpile } from '@vkontakte/elephize'","cause":"Using default import instead of named import for 'transpile'.","error":"TypeError: elephize.transpile is not a function"},{"fix":"Add await or use .then(result => ...)","cause":"Not awaiting the async transpile function.","error":"Cannot read properties of undefined (reading 'code')"},{"fix":"Rewrite without spread in JSX.","cause":"JSX spread operator is not supported.","error":"Unsupported syntax: SpreadElement"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":"elephize","cli_version":null,"type":"library","homepage":null,"github":"https://github.com/VKCOM/elephize","docs":null,"changelog":null,"pypi":null,"npm":"https://www.npmjs.com/package/dk-elephize","openapi_spec":null,"status_page":null,"smithery":null,"categories":["devops"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-05-01","next_check":"2026-07-30","install_tag":null}}