@@ -132,6 +132,8 @@ def _analyze_code_file(self, repo_dir: str, file_info: Dict):
132132 self ._analyze_c_file (file_path , content , repo_dir )
133133 elif language == "cpp" :
134134 self ._analyze_cpp_file (file_path , content , repo_dir )
135+ elif language == "php" :
136+ self ._analyze_php_file (file_path , content , repo_dir )
135137 # else:
136138 # logger.warning(
137139 # f"Unsupported language for call graph analysis: {language} for file {file_path}"
@@ -300,6 +302,28 @@ def _analyze_csharp_file(self, file_path: str, content: str, repo_dir: str):
300302 except Exception as e :
301303 logger .error (f"Failed to analyze C# file { file_path } : { e } " , exc_info = True )
302304
305+ def _analyze_php_file (self , file_path : str , content : str , repo_dir : str ):
306+ """
307+ Analyze PHP file using tree-sitter based analyzer.
308+
309+ Args:
310+ file_path: Relative path to the PHP file
311+ content: File content string
312+ repo_dir: Repository base directory
313+ """
314+ from codewiki .src .be .dependency_analyzer .analyzers .php import analyze_php_file
315+
316+ try :
317+ functions , relationships = analyze_php_file (file_path , content , repo_path = repo_dir )
318+
319+ for func in functions :
320+ func_id = func .id if func .id else f"{ file_path } :{ func .name } "
321+ self .functions [func_id ] = func
322+
323+ self .call_relationships .extend (relationships )
324+ except Exception as e :
325+ logger .error (f"Failed to analyze PHP file { file_path } : { e } " , exc_info = True )
326+
303327 def _resolve_call_relationships (self ):
304328 """
305329 Resolve function call relationships across all languages.
@@ -384,6 +408,8 @@ def _generate_visualization_data(self) -> Dict:
384408 node_classes .append ("lang-c" )
385409 elif file_ext in [".cpp" , ".cc" , ".cxx" , ".hpp" , ".hxx" ]:
386410 node_classes .append ("lang-cpp" )
411+ elif file_ext in [".php" , ".phtml" , ".inc" ]:
412+ node_classes .append ("lang-php" )
387413
388414 cytoscape_elements .append (
389415 {
0 commit comments