phply
Lexer and parser for PHP source implemented using PLY
Decision gist · record as of 2026-08-14
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.AI-flagged interpretation of the facts on this page — verify before relying
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 · maintenance · safety
BSD (permissive) — 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.
last release 2023-01-06 (1316 days) · last repo commit 2023-02-20 · 367 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 183,782 downloads/mo, #10,058 on PyPI
Alternatives
Verify before relying
pip install phply
from phply.phplex import PhpLexer
from phply.phpparse import PhpParser
lexer = PhpLexer()
parser = PhpParser()
result = parser.parse('<?php echo "hello"; ?>', lexer=lexer.lexer)- 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
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 on this page. Verify before relying on it.
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
phply on PyPI
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('<?php echo "hello"; ?>', 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 | Not specified |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | 1 packageply |
| Maintenance | Abandoned 1,316 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 183,782 / month, #10,058 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Development Status :: 5 - Production/StableEnvironment :: ConsoleIntended Audience :: EducationLicense :: OSI Approved :: BSD LicenseOperating System :: UnixProgramming Language :: PHPProgramming Language :: Python :: 2Programming Language :: Python :: 3 |
Evidence: phply-1.2.6-py2.py3-none-any.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “PHP parser Python”
- phplyphply is a lexer and parser for PHP source code that generates…
- tree-sitter-phpProvides a PHP language grammar for tree-sitter, enabling incremental…
- phpserializeConverts Python objects to and from PHP serialization format,…
Give your agent the search over MCP, or paste the wish link into any chat.
More Text Processing packages
A drop-in replacement for Python's standard `re` module that adds advanced regex features like nested sets, fuzzy matching, lookaround in conditionals, and full Unicode case-folding while maintaining backward compatibility.
pyparsing provides a library for building text parsers directly in Python code using composable grammar classes, handling quoted strings, whitespace variation, and embedded comments without regex or lex/yacc.
Install it if you need to parse text or define grammars programmatically.
fonttools manipulates font files in multiple formats (TrueType, OpenType, AFM, Type 1, Mac-specific) and includes TTX, a tool to convert fonts to and from XML text format.
Install it if you need to read, write, or manipulate fonts programmatically or via the TTX command-line tool.
Docutils converts plaintext documentation in reStructuredText format into multiple output formats including HTML, XML, and LaTeX using a modular processing system.
RapidFuzz provides fast fuzzy string matching using Levenshtein Distance and related metrics, implemented mostly in C++ with Python bindings for rapid similarity scoring and approximate string matching.
Install it if you need fuzzy string matching; it's a solid replacement for FuzzyWuzzy with better licensing and performance.
tinycss2 parses CSS strings into token and block objects, and generates CSS strings from those objects, following the CSS Syntax Level 3 specification without enforcing specific properties or values.
Install it if your project requires CSS tokenization or syntax manipulation.
See also ply · sly · rply · tree-sitter-php · ast-decompiler · pycparser · lark-parser · pygmars · php2json · phpserialize