--- id: phply version: "1.2.6" license: BSD license_treatment: permissive maintenance: abandoned --- # phply — Lexer and parser for PHP source implemented using PLY License: permissive · Maintenance: abandoned · Downloads: 183.8K/mo ## What it is and what it does phply is a PHP parser built on ply, a lexer/parser generator toolkit. It tokenizes PHP source code and builds abstract syntax trees that represent the program structure. The package includes a lexer that matches PHP's standard token set and a parser covering most of the PHP grammar, plus utility scripts to dump ASTs as JSON or convert PHP templates to Jinja2. The parser is designed for analysis and transformation tasks—converting PHP code to Python, running PHP templates in Python environments, or studying how industrial languages handle parsing edge cases. It is not a PHP runtime. The package is in a stable but abandoned state; while it has no known vulnerabilities, it receives no active maintenance and will not track PHP language evolution. Use it for: - Analyze PHP source code structure and generate ASTs for static analysis tools - Convert legacy PHP templates to Jinja2 for use in Python web frameworks - Build PHP-to-Python code migration or transpilation tools - Study parsing techniques for complex, real-world language grammars - Extract metadata or patterns from PHP codebases programmatically ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. phply is a lexer and parser for PHP source code that generates abstract syntax trees, enabling PHP code analysis and conversion to other formats like JSON or Jinja2 templates. Yes, if you need to parse PHP code for analysis or conversion and can accept that the parser may not handle very recent PHP syntax. The low install friction and permissive license make it accessible. No, if you require active maintenance, support for modern PHP versions, or a runtime environment—phply is abandoned and will not evolve with the PHP language. ## Install pip install phply uv add phply poetry add phply ## Installing phply Before you install: Installation is straightforward with a single pure-Python dependency (ply). However, the package is abandoned—last commit was 2023-02-20 and no releases in over 1316 days. It will not receive bug fixes or updates for newly discovered PHP syntax or language features. License in practice: BSD license is permissive, allowing use in both open-source and proprietary projects with minimal restrictions. You must include a copy of the license and retain authorship notices. Quickstart: pip install phply from phply.phplex import PhpLexer from phply.phpparse import PhpParser lexer = PhpLexer() parser = PhpParser() result = parser.parse('', lexer=lexer.lexer) Verify before relying: - Whether the parser handles modern PHP syntax or only older versions - Completeness of PHP grammar coverage beyond labels and goto statements - Stability and correctness of the Jinja2 conversion tool for real-world templates ## Package facts - License: BSD (permissive) - Python support: unspecified - Install friction: low - Maintenance: abandoned - Downloads: 183.8K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags PHP parser Python, PHP lexer analyzer, PHP to AST converter, PHP code parsing, PHP syntax tree generator, PHP source analysis, PLY-based PHP parser, parser-generator, code-analysis, language-tools [View on SkillFed](https://skillfed.io/packages/phply) · [View on PyPI](https://pypi.org/project/phply/)