Read and write php arrays with python
Project description
php_whisperer
"I heard you help people with PHP problems?" "Truth is, I help PHP with people problems."
Read PHP
Convert PHP arrays to Python objects using read_php
from php_whisperer import read_php
read_php('/tmp/a_php_file.php', variable='data')
Result:
{'My Php Array': ['You', 'get', 'the', 'point']}
Read many php files:
from php_whisperer import read_many
file1 = open('/tmp/php_file.php')
file2 = open('/tmp/php_file2.php')
file3 = open('/tmp/php_file3.php')
read_many(file1, file2, "$x = File1::doSomethingWith($something_from_file2)", file3, variable='x')
Result:
{'My Php Array': ['You', 'get', 'the', 'point']}
Write PHP
Convert Python lists and dictionaries to PHP using generate_php
from php_whisperer import generate_php
generate_php([1, 2, 3, 4])
Result:
array(1, 2, 3, 4);
Modern syntax also available:
from php_whisperer import generate_php
generate_php([1, 2, 3, 4], modern=True)
Result:
[1, 2, 3, 4];
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Filename, size | File type | Python version | Upload date | Hashes |
---|---|---|---|---|
Filename, size php_whisperer-2.0.0-py3-none-any.whl (6.0 kB) | File type Wheel | Python version py3 | Upload date | Hashes View |
Filename, size php_whisperer-2.0.0.tar.gz (4.6 kB) | File type Source | Python version None | Upload date | Hashes View |
Close
Hashes for php_whisperer-2.0.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 03fa9e777063f5c897b8d246120188c5ac72611bdab7431c84623c2b2174a086 |
|
MD5 | 09874d4888d68c4c800efba9584d07ec |
|
BLAKE2-256 | 996a9cc752c887676190a13a58eeb841a6a7efc302044a11e3353e0fee779e5d |