Skip to content
master
Go to file
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

README.rst

phPy

phPy is a simple way to call legacy PHP functions from Python.

Installation

You can install the package from PyPI:

$ pip install phpy

Requirements

phPy uses php5-cli. You have to install the php5-cli package by using apt-get or yum.

$ apt-get install php5-cli
$ yum install php

Example

function LegacyPHPFunction($arg1, $arg2, $arg3) {
    //... original codes...

    $result = array(
        "foo" => $arg1,
        "bar" => $arg2,
    );

    echo json_encode($result);
}
from phpy import PHP

#php_file_path = the path of your legacy php file...
php = PHP(php_file_path)
result_raw = php.get_raw('LegacyPHPFunction', ['argument1',u'argument2', 3]) # get a return value as a raw string
result_dict = php.get_dict('LegacyPHPFunction', ['argument1',u'argument2', 3]) # get return values as a python dictionary
print result_dict['foo']

Continuous Integration (Travis CI)

https://travis-ci.org/leekchan/phpy/

Build Status

About

phPy is a simple way to call legacy PHP functions from Python.

Resources

License

You can’t perform that action at this time.