Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
This repository was archived by the owner on Mar 19, 2026. It is now read-only.

jpollard3/php-serialize

Open more actions menu
 
 

Repository files navigation

PHP-Serialize

Greenkeeper badge PHP-Serialize is node library that helpers you encode/decoded data in PHP's Serialization format.

It also supports Serializable objects decode. Here's how you can use them.

const Serialize = require('php-serialize')
class User {
  constructor({ name, age }){
    this.name = name
    this.age = age
  }
  serialize(){
    return JSON.stringify({ name: this.name, age: this.age })
  }
  unserialize(rawData){
    const { name, age } = JSON.parse(rawData)
    this.name = name
    this.age = age
  }
}
const steel = new User({ name: "Steel Brain", age: 17 })
const Serialized = Serialize.serialize(steel)
const Unserialized = Serialize.unserialize(Serialized, {User: User}) // Passing available classes
console.log(Unserialized instanceof User) // true

API

class Serializable {
  serialize(item: any): string
  unserialize(item: string, scope: Object = {}, options: { strict: boolean } = { strict: false }): any
}

License

This project is licensed under the terms of MIT License. See the License file for more info.

About

PHP Serialize/Unserialize in Javascript

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages

  • JavaScript 96.6%
  • PHP 3.4%
Morty Proxy This is a proxified and sanitized view of the page, visit original site.