Skip to main content
This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (pypi.python.org).
Help us improve Python packaging - Donate today!

Handle some of the strange standards in PHP projects

Project Description

Making some of those PHP-only functions available to Python

Sometimes you want to write a Python script for a project written in PHP. For the most part, this is easy, but for a few key things, PHP breaks with the standard and does things in a its own way. For these cases, you can use this module to compensate.

Php.http_build_query()

This was ripped shamelessly from a PHP forum and ported to Python:

Essentially, it’s a (hopefully perfect) replica of PHP’s http_build_query() that allows you to pass multi-dimensional arrays to a PHP-managed URL via POST or GET.

Php.parse_ini_file()

A hacked-together attempt at making an .ini file parser that’s compatible with the “standards” that PHP follows in its parse_ini_file() function. Among the handy features included are:

  • List notation (varname[] = value)
  • Associative array notation (varname[key] = value)
  • Removal of wrapping doublequotes (varname = "stuff" becomes varname = stuff)

You can turn off the doublequote removal with stripquotes=False

Example

from php.php import Php
config = Php.parse_ini_file("config.ini")
print config["sectionName"]["keyName"]
Release History

Release History

This version
History Node

1.2.0

History Node

1.1.7

History Node

1.1.6

History Node

1.1.5

History Node

1.1.4

History Node

1.1.2

History Node

1.1

History Node

1.0

Download Files

Download Files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
php-1.2.0.tar.gz (3.9 kB) Copy SHA256 Checksum SHA256 Source Aug 6, 2016

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting