php2json
A small library that aims to provide a fast way of decoding PHP serialization format. Use it if you need to migrate large amount of PHP data and performance is essential.
The library provides only one function:
>>> import php2json >>> php2json.php2json(b's:3:"foo";') b'"foo"'
It’s goal is to convert PHP serializer string into JSON string as fast as possible. The assumption is that JSON decoders (such as standard json module or ujson) are much better optimized than phpserialize.
Here’s a simple benchmark where I pit phpserialize against php2json combined with ujson and json:
phpserialize: 6.60s php2json+ujson: 0.15s php2json+json: 0.19s speedup (ujson): 4337% speedup (json): 3485%
Installation
Install with:
pip install php2json
Tests
Run test with:
pip install tox make clean tox .
Benchmark
Run benchmark with:
pip install -r requirements-test.txt make bench
Limitations
Few limitations apply:
only deserialization is possible
PHP objects are not supported
behaviour is undefined in presence of unicode strings
input data must adhere to JSON standards, most notably: array keys must be strings or values easily convertible to strings (such as integers)
Metadata
Release files for php2json 0.2
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 | |
|---|---|---|---|---|
| php2json-0.2.tar.gz | 3.8 kB | Without provenance | Details |
Built distributions (wheels)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| php2json-0.2-cp36-cp36m-manylinux1_x86_64.whl | CPython 3.6 | CPython 3.6 pymalloc | Linux glibc 2.5+ x86-64 | Details |
| php2json-0.2-cp27-cp27mu-manylinux1_x86_64.whl | CPython 2.7 | CPython 2.7 pymalloc wide-unicode | Linux glibc 2.5+ x86-64 | Details |
Total release size: 72.3 kB
Release files / php2json-0.2.tar.gz
| Download URL | php2json-0.2.tar.gz |
|---|---|
| Size | 3.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
581c370c4b745e26c487e695b724b85d85041aff80bff234b9542bd8d8317c01
|
|
BLAKE2b-256 checksum How to use checksums |
04605f22822ef526a48c6166edf1c346463fb6ec8dd314189604a4df5ff5878d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / php2json-0.2-cp36-cp36m-manylinux1_x86_64.whl
| Download URL | php2json-0.2-cp36-cp36m-manylinux1_x86_64.whl |
|---|---|
| Size | 35.4 kB |
| Tags | CPython 3.6 CPython 3.6 pymalloc Linux glibc 2.5+ x86-64 |
|
SHA-256 checksum How to use checksums |
68c4d5fce14c5f4168bd854f6a9236c2afd2321566f18f69a61d87753943f811
|
|
BLAKE2b-256 checksum How to use checksums |
a83079813746456829526d107af5c8d99d567a6cba16233e2b4b6f4461b3156e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / php2json-0.2-cp27-cp27mu-manylinux1_x86_64.whl
| Download URL | php2json-0.2-cp27-cp27mu-manylinux1_x86_64.whl |
|---|---|
| Size | 33.1 kB |
| Tags | CPython 2.7 CPython 2.7 pymalloc wide-unicode Linux glibc 2.5+ x86-64 |
|
SHA-256 checksum How to use checksums |
707029466175d608afc4c1ac074d71e8f4e08798bd6cb9390bc621b939432662
|
|
BLAKE2b-256 checksum How to use checksums |
fdf0ebc89fd1fbd115b8defd3ff6bce8e634f2912bd571d0a23cfd0a68bece15
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for php2json 0.2
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.