23 releases

0.24.2 Aug 18, 2025
0.23.11 Nov 20, 2024
0.23.5 Oct 15, 2024
0.22.8 Jul 26, 2024
0.20.0 Nov 18, 2023

#2605 in Parser implementations

Download history 7516/week @ 2025-07-25 6832/week @ 2025-08-01 7780/week @ 2025-08-08 7106/week @ 2025-08-15 7476/week @ 2025-08-22 9156/week @ 2025-08-29 9369/week @ 2025-09-05 9777/week @ 2025-09-12 8085/week @ 2025-09-19 8967/week @ 2025-09-26 8481/week @ 2025-10-03 8664/week @ 2025-10-10 14044/week @ 2025-10-17 30167/week @ 2025-10-24 29786/week @ 2025-10-31 35150/week @ 2025-11-07

110,921 downloads per month
Used in 51 crates (32 directly)

MIT license

14MB
375K SLoC

C 373K SLoC // 0.0% comments JavaScript 1.5K SLoC // 0.0% comments Scheme 204 SLoC // 0.0% comments Rust 54 SLoC

This crate provides PHP language support for the tree-sitter parsing library.

Typically, you will use the [LANGUAGE_PHP][] constant to add this language to a tree-sitter Parser, and then use the parser to parse some code:

use tree_sitter::Parser;

let code = r#"
<?php
  echo "Hello, World!";
?>
"#;
let mut parser = Parser::new();
let language = tree_sitter_php::LANGUAGE_PHP;
parser
    .set_language(&language.into())
    .expect("Error loading PHP parser");
let tree = parser.parse(code, None).unwrap();
assert!(!tree.root_node().has_error());

tree-sitter-php

CI discord matrix crates npm pypi

PHP grammar for tree-sitter.

Dependencies