A python script to convert simple php code to python,
It just converts the basic syntax
It is the one i use in the conversion mpg25/Instagram-API in PHP to danleyb2/Instagram-API in PYTHON
## usage
```
$ python php2python.py -h
usage: php2python.py [-h] -s SCRIPT [-o]
PHP to PYTHON syntax converter.
optional arguments:
-h, --help show this help message and exit
-s SCRIPT, --script SCRIPT
Path to PHP script
-o, --overwrite Overwrite Python script if exists
```
```
$ python php2python.py -s test_scripts/Caption.php
Converting: test_scripts/Caption.php. Output file will be: test_scripts/Caption.py
# Remove opening and closing <?php
# convert $this-> to self.
# convert :: to .
# delete all }
# delete namespace|require_once|include_once
# convert protected $var to self.var = None then move into __init__
# convert public|protected function to def
# add `self` to function signatures
# classes not children to extend `object`
# convert $ to ''
# convert ; to ''
# convert new to ''
Converted: test_scripts/Caption.php. to: test_scripts/Caption.py. { Go on, Proof Check :) }
```
```
$ python php2python.py -s test_scripts/Caption.php
Sorry, A python Script test_scripts/Caption.py already exist, use -o to overwrite.
```
Metadata
Release files for convert2php 0.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| convert2php-0.0.1.tar.gz | 3.8 kB | Without provenance | Details |
Release files / convert2php-0.0.1.tar.gz
| Download URL | convert2php-0.0.1.tar.gz |
|---|---|
| Size | 3.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7548199fcdaeab8b1e16a5ed6e75b78cfb876b54b9bd003e00ad08730b2ee88b
|
|
BLAKE2b-256 checksum How to use checksums |
30baafea59e34b8493c3318251a299c4fbb4aa132981b1f1a29478a9b5f69183
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for convert2php 0.0.1
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.