Skip to main content

phply

PyPI version PyPI - Python Version GitHub release License

Enhanced fork of phply — fixes core AST bugs, supports PHP 5.6 through 8.5 syntax.

Installation

pip install lphply

Note: Since the internal package name of lphply is still phply, it conflicts with the upstream viraptor/phply PyPI package. If you have previously installed phply, please uninstall it first: pip uninstall phply && pip install lphply.

Usage

Lexer

from phply.phplex import lexer

lexer.input('<?php echo "Hello, World!"; ?>')
for token in lexer:
    print(token)

Parser

from phply.phplex import lexer
from phply.phpparse import make_parser

parser = make_parser()
with open('example.php', 'r') as f:
    code = f.read()
result = parser.parse(code, lexer=lexer)

Command-line tools

# Parse a PHP file
phpparse file.php

# Lex a PHP file
phplex file.php

Development

Clone the repository and install in development mode:

git clone https://github.com/LoRexxar/Lphply.git
cd Lphply
pip install -e ".[test]"

Running tests

pytest

License

BSD-3-Clause. See LICENSE for details.

Credits

Fork of viraptor/phply, originally by Dave Benjamin.

Download files

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

Source Distribution

lphply-2.2.0.tar.gz (95.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

lphply-2.2.0-py3-none-any.whl (85.0 kB view details)

Uploaded Python 3

File details

Details for the file lphply-2.2.0.tar.gz.

File metadata

  • Download URL: lphply-2.2.0.tar.gz
  • Upload date:
  • Size: 95.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.15

File hashes

Hashes for lphply-2.2.0.tar.gz
Algorithm Hash digest
SHA256 a9b3b5b186a6d718ab43cf9018c1f67bd76e4309ee32eb8347deb2c72c40561d
MD5 7f007ce4622f96bec62e6a071c63a9ab
BLAKE2b-256 13d4bf477df71cb2cd8c9ab29a572fe72d67e573554d9d898f98dc1af2d158fe

See more details on using hashes here.

File details

Details for the file lphply-2.2.0-py3-none-any.whl.

File metadata

  • Download URL: lphply-2.2.0-py3-none-any.whl
  • Upload date:
  • Size: 85.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.15

File hashes

Hashes for lphply-2.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2762234ce9f721c431b769a6b9fdfde6ebbce250aa754dffd808e00c92cce26b
MD5 16ef6d003673f7b658824eb72ce9663a
BLAKE2b-256 4ab2c68e76fe10faf47bbfab6b1f577b4b8b9094afe8e32e83798cbbca5d32a5

See more details on using hashes here.

Release history Release notifications | RSS feed

2.2.1

2 files

This release

2.2.0 This release

2 files

2.1.0

2 files

2.0.0

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page