Skip to main content

A Python package for php_ast

Project description

Python Get PHP-AST

PHP-AST PHP version social

Install

pip install  php-ast

exapme

# get bytes php code ast
from php_ast import php_ast
php_ast=php_ast()
php_ast.get_ast(b"<?php phpinfo();?>")
{'status': 'successed', 'ast': {'kind': 'AST_STMT_LIST', 'flags': 0, 'lineno': 1, 'children': [{'kind': 'AST_CALL', 'flags': 0, 'lineno': 1, 'children': {'expr': {'kind': 'AST_NAME', 'flags': 1, 'lineno': 1, 'children': {'name': 'phpinfo'}}, 'args': {'kind': 'AST_ARG_LIST', 'flags': 0, 'lineno': 1, 'children': []}}}]}}



# get php file ast
from php_ast import php_ast
php_ast=php_ast()
php_ast.get_file_ast("/home/11.php")
{'status': 'successed', 'ast': {'kind': 'AST_STMT_LIST', 'flags': 0, 'lineno': 1, 'children': [{'kind': 'AST_CALL', 'flags': 0, 'lineno': 1, 'children': {'expr': {'kind': 'AST_NAME', 'flags': 1, 'lineno': 1, 'children': {'name': 'phpinfo'}}, 'args': {'kind': 'AST_ARG_LIST', 'flags': 0, 'lineno': 1, 'children': []}}}]}}

说明

  • 本项目是基于php-ast扩展的python模块,用于获取php代码的ast树
  • 暂时只支持Linux 系统

参考:

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

php_ast-1.5.tar.gz (4.0 MB view details)

Uploaded Source

Built Distribution

php_ast-1.5-py3-none-any.whl (4.0 MB view details)

Uploaded Python 3

File details

Details for the file php_ast-1.5.tar.gz.

File metadata

  • Download URL: php_ast-1.5.tar.gz
  • Upload date:
  • Size: 4.0 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.7.9

File hashes

Hashes for php_ast-1.5.tar.gz
Algorithm Hash digest
SHA256 47112778ae23754c0c6696901040c77da3790d355ddb2b11e7ab94b08f70b3cf
MD5 8666ef11d4a9cf8f325d1e79baba316b
BLAKE2b-256 89b6243f17a73d19b944a2497b2275f236b2f969e56c88542a310e8c04a3b03c

See more details on using hashes here.

File details

Details for the file php_ast-1.5-py3-none-any.whl.

File metadata

  • Download URL: php_ast-1.5-py3-none-any.whl
  • Upload date:
  • Size: 4.0 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.7.9

File hashes

Hashes for php_ast-1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 e7c032f96b90152b9bb3c9da5908d0e273082702aad1c310d499a83e0353a387
MD5 0acf645fdd5ea3269c77f668707aa880
BLAKE2b-256 bcdedf6082610bfd7bb2e84f2eaadcfb6fa62e978a62595c1c43e5d0bbe25f88

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page