Socket
Socket
Sign inDemoInstall

php-serialize

Package Overview
Dependencies
Maintainers
1
Versions
24
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

php-serialize

PHP Serialize/Unserialize in Javascript


Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

PHP-Serialize

PHP-Serialize is tiny 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. (Note: This example uses ES6)

let Serialize = require('php-serialize')
class User{
  constructor(Info){
    this.Name = Info.Name
    this.Age = Info.Age
  }
  serialize(){
    return JSON.stringify({Name: this.Name, Age: this.Age})
  }
  unserialize(Data){
    Data = JSON.parse(Data)
    this.Name = Data.Name
    this.Age = Data.Age
  }
}
let Steel = new User({Name: "Steel Brain", Age: 16})
let Serialized = Serialize.serialize(Steel)
let Unserialized = Serialize.unserialize(Serialized, {User: User}) // Passing available classes
console.log(Unserialized instanceof User) // true
API
class Serializable{
  serialize(Item): string
  unserialize(Item, Scope = {})
}
License

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

FAQs

Package last updated on 22 Jun 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc