Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

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 - npm Package Compare versions

Comparing version 3.0.1 to 4.0.0

lib/cjs/helpers.js

7

CHANGELOG.md

@@ -0,1 +1,8 @@

### 4.0.0
- Add TS Typings - Thanks [@vace](https://github.com/vace)
- Convert arrays with missing keys to objects in unserialize
- **BREAKING** Export modules in CJS and CommonJS.
- Add support for parsing protected and private fields
## 3.0.1

@@ -2,0 +9,0 @@

45

package.json
{
"name": "php-serialize",
"version": "3.0.1",
"version": "4.0.0",
"description": "PHP serialize/unserialize in Javascript",
"main": "lib/index.js",
"main": "lib/cjs/index.js",
"typings": "src/index.ts",
"module": "lib/esm/index.js",
"scripts": {
"test": "ava spec/*-spec.js",
"test:update-php-output": "php spec/serialize.php > spec/serialize.php.out",
"lint": "(flow check) && (eslint . ) && (prettier --list-different src/*.js)",
"build": "sb-babel-cli src -o lib",
"watch": "npm run build -- -w",
"prepare": "npm run build"
"test": "ava",
"test:update-php-output": "php test/serialize.php > test/serialize.php.out",
"lint": "(tsc -p . --noEmit) && (eslint . --ext .ts) && (prettier --list-different src/*.ts)",
"prepare": "yarn build:clean ; yarn build:esm ; yarn build:cjs ",
"build:clean": "rm -rf lib",
"build:esm": "tsc --module es2015 --target es5 --outDir lib/esm",
"build:cjs": "tsc --module commonjs --target es5 --outDir lib/cjs"
},

@@ -23,13 +26,25 @@ "repository": {

},
"files": [
"src/*",
"lib/*"
],
"homepage": "https://github.com/steelbrain/php-serialize#readme",
"devDependencies": {
"@babel/core": "^7.4.3",
"@babel/preset-env": "^7.4.3",
"@babel/preset-flow": "^7.0.0",
"ava": "^1.0.1",
"eslint-config-steelbrain": "^7.0.0",
"flow-bin": "^0.98.0",
"sb-babel-cli": "^2.0.0"
"ava": "^3.7.0",
"eslint-config-steelbrain": "^9.0.1",
"ts-node": "^8.8.2",
"typescript": "^3.8.3"
},
"dependencies": {},
"ava": {
"files": [
"test/*-test.ts"
],
"extensions": [
"ts"
],
"require": [
"ts-node/register/transpile-only"
]
},
"engines": {

@@ -36,0 +51,0 @@ "node": ">= 8"

@@ -6,3 +6,4 @@ # PHP-Serialize

```js
const Serialize = require('php-serialize')
import {serialize, unserialize} from 'php-serialize'
class User {

@@ -23,7 +24,7 @@ constructor({ name, 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
const serialized = serialize(steel)
const unserialized = unserialize(serialized, { User: User }) // Passing available classes
console.log(unserialized instanceof User) // true
const serializedForNamespace = Serialize.serialize(steel, {
const serializedForNamespace = serialize(steel, {
'MyApp\\User': User,

@@ -37,18 +38,16 @@ })

```js
class Serializable {
serialize(
item: any,
phpToJsScope: Object = {},
options: { encoding: 'utf8' | 'binary' } = { encoding: 'utf8' }
): string
unserialize(
item: string,
scope: Object = {},
options: { strict: boolean, encoding: 'utf8' | 'binary' } = { strict: false, encoding: 'utf8' }
): any
isSerialized(
item: any,
strict: false
): boolean
}
export function serialize(
item: any,
phpToJsScope: Object = {},
options: { encoding: 'utf8' | 'binary' } = { encoding: 'utf8' }
): string
export function unserialize(
item: string,
scope: Object = {},
options: { strict: boolean, encoding: 'utf8' | 'binary' } = { strict: false, encoding: 'utf8' }
): any
export function isSerialized(
item: any,
strict: false
): boolean
```

@@ -55,0 +54,0 @@

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