Skip to content

expreva/php-parser

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PHP Parser

This is a standalone library to parse PHP in Node.js. It bundles a PHP runtime compiled to WebAssembly, so it doesn't depend on PHP being installed on the local system.

Install

npm install @expreva/php-parser

Usage

import { createPhp } from '@expreva/php-parser'

await php = await createPhp()

const code = `<?php echo 'hi';`

const {
  parsed, // Node[]
  error   // Error
} = await php.parse(code)

console.log(parsed)

Abstract Syntax Tree

See https://github.com/nikic/PHP-Parser/blob/master/doc/component/JSON_representation.markdown

Included libraries

About

Standalone library to parse PHP using PHP-WASM

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published