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.

Metadata

Release files for lphply 2.2.13

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for lphply 2.2.13
File Size Uploaded Provenance Actions
lphply-2.2.13.tar.gz 141.9 kB Without provenance Details for lphply-2.2.13.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for lphply 2.2.13
File Interpreter ABI Platform Actions
lphply-2.2.13-py3-none-any.whl Python 3 none any Details for lphply-2.2.13-py3-none-any.whl

Total release size: 261.1 kB

Release files / lphply-2.2.13.tar.gz

Download URL lphply-2.2.13.tar.gz
Size 141.9 kB
Tags Source
SHA-256 checksum
How to use checksums
c8c08819c68c5f07b71bfdc1d68dbbfd57dc1bc8f0e0dcbd7a0410b9cb31ac14
BLAKE2b-256 checksum
How to use checksums
698bd71acbf59ca62ed8a3401455e77c9ad2bc9c4b16fbd0c8ac6fa745785982
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.3

Release files / lphply-2.2.13-py3-none-any.whl

Download URL lphply-2.2.13-py3-none-any.whl
Size 119.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1b9098f7a0f881c1407aa6ef3c65b469e24ade93e709e664d6b528fd3448d04e
BLAKE2b-256 checksum
How to use checksums
c7091a6e2b2a2035733e74e125f38c9f10dd14a33aef2ba374da36639eaf7835
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.3

Security for lphply 2.2.13

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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