ceratech / php-unserializer   0.1

GNU General Public License v3.0 only GitHub

A Scala language reader for the PHP serialization format.

Scala versions: 2.12

PHP unserializer for Scala

Build Status Download Coverage Status

Library that unserializes PHP serialized strings (through PHPs serialize method.).

Supports basic values, array (also asociative) and PHP objects.

Installation

Add the following resolver to your build.sbt:

resolvers += Resolver.bintrayRepo("ceratech", "maven")

Add the following dependency to your dependencies:

libraryDependencies += "io.ceratech" %% "php-unserializer" % "0.1"

Usage

Call the unserialize method of the PHPSParser object. Like so:

PHPSParser.unserialize(inputString)

The resulting value is an Any.

Types

Parse results, given a certain input:

  • A non-asociative array in the serialized data will be parsed into a Scala list
  • A asociative array in the serialized data will be parsed into a Scala map
  • PHPs null will be parsed into a Scala None

Acknowledgements

This project is a fork from Scala PHPS cleaning up some things and adding deployment for simplified usage.