--- id: tree-sitter-php version: "0.24.1" license: MIT license_treatment: permissive maintenance: active --- # tree-sitter-php — PHP grammar for tree-sitter License: permissive · Maintenance: active · Downloads: 7.3M/mo ## What it is and what it does tree-sitter-php is a language grammar module that provides PHP syntax parsing for the tree-sitter incremental parsing framework. It enables developers to parse PHP code into abstract syntax trees for analysis, transformation, or tooling purposes. The package provides precompiled binaries for major platforms (macOS x86/arm, Linux x86/arm, Windows), reducing installation friction compared to building from source. The package is part of the broader tree-sitter ecosystem and is actively maintained, with recent commits and no known security vulnerabilities. It requires Python 3.10 or later and has no runtime dependencies beyond the tree-sitter framework itself. Use it for: - Build linters or code formatters that analyze PHP syntax trees for style violations or refactoring opportunities. - Implement static analysis tools that traverse PHP ASTs to detect bugs, security issues, or code smells. - Create IDE extensions or editor plugins that provide syntax highlighting or navigation for PHP. - Parse and transform PHP code programmatically for code generation, migration, or automated refactoring. - Analyze large PHP codebases to extract metrics, dependencies, or architectural patterns. ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. Provides a PHP language grammar for tree-sitter, enabling incremental parsing and syntax tree analysis of PHP code. Yes, if you need to parse or analyze PHP code programmatically within the tree-sitter ecosystem. The package is actively maintained, has no security vulnerabilities, uses a permissive MIT license, and medium install friction is acceptable for a compiled grammar. Not necessary if you're not already using tree-sitter or if you only need basic PHP tokenization. ## Install pip install tree-sitter-php uv add tree-sitter-php poetry add tree-sitter-php ## Installing tree-sitter-php Before you install: Medium install friction due to compiled wheels; prebuilt binaries available for common platforms (macOS x86/arm, Linux x86/arm, Windows). Requires Python 3.10+. Actively maintained with recent commits and no reported security issues. License in practice: MIT license permits free use, modification, and distribution with minimal restrictions—suitable for both open-source and commercial projects. Quickstart: pip install tree-sitter-php Requires Python 3.10 or later; integration with tree-sitter core library required for actual parsing. Verify before relying: - How to load and use the grammar binary after installation with tree-sitter bindings. - Whether precompiled binaries include the PHP grammar or if separate compilation is needed. - API stability and compatibility guarantees across minor versions. ## Package facts - License: MIT (permissive) - Python support: supports_current - Install friction: medium - Maintenance: active - Downloads: 7.3M/month (top 5,000 on PyPI) - Known vulnerabilities: none known ## Tags php parsing tree-sitter, incremental php parser, php syntax tree, tree-sitter language grammar, php code analysis, parse php with tree-sitter, php ast generation, parsing, php, ast [View on SkillFed](https://skillfed.io/packages/tree-sitter-php) · [View on PyPI](https://pypi.org/project/tree-sitter-php/)