--- id: phpserialize version: "1.3" license: UNKNOWN license_treatment: permissive maintenance: dormant --- # phpserialize — a port of the serialize and unserialize functions of php to python. License: permissive · Maintenance: dormant · Downloads: 272.7K/mo ## What it is and what it does phpserialize is a Python port of PHP's serialize and unserialize functions, enabling bidirectional conversion between Python objects and PHP serialization format. It implements the standard Python serialization interface with `dumps`, `loads`, and file-like object support. The package handles PHP's type system differences: lists become dicts (with integer keys), unicode strings are UTF-8 encoded by default, and None/floats/booleans are converted to PHP-compatible types. It also supports PHP object serialization through hooks and provides helper functions like `dict_to_list` and `dict_to_tuple` to recover Python data structures. Version 1.3 added Python 3 support using the 'surrogateescape' error handler for bytes/unicode handling. Use it for: - Deserialize PHP session data or cache stored in PHP format within a Python application - Exchange structured data between PHP and Python services without JSON/XML conversion overhead - Migrate or synchronize data from PHP applications to Python backends while preserving PHP object metadata - Test PHP serialization logic in Python test suites by round-tripping PHP-serialized objects - Parse WordPress or other PHP framework object data in Python analysis or migration tools ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. Converts Python objects to and from PHP serialization format, implementing the `dumps`/`loads` interface for cross-language data exchange. Yes, but with caution. The package is stable for basic PHP serialization tasks and carries no known vulnerabilities, but it has been dormant since 2012 with minimal maintenance. Install if you have a specific need to interoperate with PHP serialized data and accept that bug fixes or Python version compatibility updates are unlikely. For new projects, consider whether JSON or another standard format would reduce coupling to PHP. ## Install pip install phpserialize uv add phpserialize poetry add phpserialize ## Installing phpserialize Before you install: High install friction due to source-only distribution. Package is dormant since 2012 with no recent maintenance, though the repository shows a recent commit in 2024. No runtime dependencies. License in practice: Licensed under BSD (permissive), allowing commercial and private use with minimal restrictions. Quickstart: from phpserialize import dumps, loads # Serialize a Python string obj = dumps("Hello World") print(loads(obj)) # 'Hello World' # Handle lists (serialized as dicts in PHP) from phpserialize import dict_to_list result = dict_to_list(loads(dumps([1, 2, 3]))) print(result) # [1, 2, 3] No Python version requirement specified; test compatibility with your target Python version before production use. Verify before relying: - Whether the 2024 repository commit represents active maintenance or a one-off update - Python 3 compatibility status beyond the version 1.3 changelog note - Whether binary data handling via 'surrogateescape' is production-ready ## Package facts - License: UNKNOWN (permissive) - Python support: unspecified - Install friction: high - Maintenance: dormant - Downloads: 272.7K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags php serialization python, serialize unserialize php, php data format python, cross-language object serialization, php compatible serialization, php-interop, serialization [View on SkillFed](https://skillfed.io/packages/phpserialize) · [View on PyPI](https://pypi.org/project/phpserialize/)