All Projects → nicolasrod → php2python

nicolasrod / php2python

Licence: MIT license
Convert PHP code to Python under CGI (beta)

Programming Languages

python
139335 projects - #7 most used programming language
PHP
23972 projects - #3 most used programming language

Projects that are alternatives of or similar to php2python

ucast
Conditions query translator for everything
Stars: ✭ 76 (+72.73%)
Mutual labels:  translator, ast
Headache
Programming Language that compiles to 8 Bit Brainfuck
Stars: ✭ 59 (+34.09%)
Mutual labels:  translator, ast
SimpleTranslationSystem
A simple C# translation system
Stars: ✭ 14 (-68.18%)
Mutual labels:  translator
fanyi.el
Not only English-Chinese translator for Emacs.
Stars: ✭ 39 (-11.36%)
Mutual labels:  translator
RTranslator
RTranslator is the world's first open source real-time translation app.
Stars: ✭ 59 (+34.09%)
Mutual labels:  translator
tr4n5l4te
Use Google Translate without an API key.
Stars: ✭ 32 (-27.27%)
Mutual labels:  translator
pollly
The simplest editor to translate apps & sites for YML files. Fast and Simple. Try now!
Stars: ✭ 32 (-27.27%)
Mutual labels:  translator
Braille-Translator
Translates standard alphabet based text to Grade 2 Braille and back.
Stars: ✭ 29 (-34.09%)
Mutual labels:  translator
Geyser
A bridge/proxy allowing you to connect to Minecraft: Java Edition servers with Minecraft: Bedrock Edition.
Stars: ✭ 2,851 (+6379.55%)
Mutual labels:  translator
linguist
Linguist is a powerful browser extension for translate pages and text, which are ready to replace your favorite translate service
Stars: ✭ 21 (-52.27%)
Mutual labels:  translator
bing-translate-api
A simple and free API for Bing Translator for Node.js
Stars: ✭ 37 (-15.91%)
Mutual labels:  translator
text2text
Text2Text: Cross-lingual natural language processing and generation toolkit
Stars: ✭ 188 (+327.27%)
Mutual labels:  translator
NMSAlphabetAndroidApp
An unofficial translator app for No Man's Sky
Stars: ✭ 22 (-50%)
Mutual labels:  translator
tarjama
This package allows you to translate your models fields. `2.0` version will be continued here: https://github.com/fevrok/laravel-translatable
Stars: ✭ 2 (-95.45%)
Mutual labels:  translator
Translation
The Translation component provides tools to internationalize your application.
Stars: ✭ 6,196 (+13981.82%)
Mutual labels:  translator
andaluh-js
Transliterate español (spanish) spelling to andaluz proposals using javascript
Stars: ✭ 22 (-50%)
Mutual labels:  translator
react-translator-component
React language translation module for developing a multilingual project.
Stars: ✭ 13 (-70.45%)
Mutual labels:  translator
HighlightTranslator
Highlight Translator can help you to translate the words quickly and accurately. By only highlighting, copying, or screenshoting the content you want to translate anywhere on your computer (ex. PDF, PPT, WORD etc.), the translated results will then be automatically displayed before you.
Stars: ✭ 54 (+22.73%)
Mutual labels:  translator
Misakatranslator
御坂翻译器—Galgame/文字游戏/漫画多语种实时机翻工具
Stars: ✭ 2,211 (+4925%)
Mutual labels:  translator
stache
A Mustache template compiler.
Stars: ✭ 16 (-63.64%)
Mutual labels:  translator

PHP2Python

Convert PHP code to Python running under CGI (beta).

Requirements

Install dependencies

$ php composer.phar install
$ python3 -m pip install -r requirements.txt

If you have composer / pip installed globally:

$ composer install
$ pip3 install -r requirements.txt

Converting WordPress source code to Python

In the folder ./wordpress-5.4 there's a copy of WP and its convertion with the tool:

$ python3 php2py.py --keep-ast ./wordpress-5.4

This produces *.py files, the *.ast (because --keep-ast is used) and if there's any error (which should be at the moment) *.errors.txt files.

In order to run the converted files you need to specify the full path of the PHP compatibility library in the PHP2PY_COMPAT environmental variable:

$ cd ./wordpress-5.4
$ PHP2PY_COMPAT=$HOME/php_compat.py python3 index.py

There are a few things left to finish in order to get a complete working converting without having to edit to converted code. I was waiting to tackle those before publishing the code but I'm not having much spare time left these days.

Any PRs and/or comments are more than welcome.

Roadmap

  • Complete implementation of AST nodes transformation.
  • Address limitations of Python language
  • Finish implementing all of the supporting PHP functions to run WordPress.
  • Rearrange AST nodes to simplify conversion.
  • Refactor converted code to output Flask/Django code instead. Requires an overhaul of the import mechanism.

Licence

Copyright Nicolás Rodriguez ([email protected])

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].