
Security News
Axios Supply Chain Attack Reaches OpenAI macOS Signing Pipeline, Forces Certificate Rotation
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.
@trim21/php-serialize
Advanced tools
serialize and deserialize php encoded string to/from js Object/Array/Map.
npm add @trim21/php-serialize
yarn add @trim21/php-serialize
pnpm add @trim21/php-serialize
import * as php from '@trim21/php-serialize'
class User {
[php.ObjectName] = 'User'
private name: string
private age: number
constructor({ name, age }) {
this.name = name
this.age = age
}
}
php.stringify({
b: true,
a: [1, 2, 3, 'a', 100n, null, undefined],
s: 'str',
m: new Map([
[1, 2],
[2, 'b'],
]),
withObjectName: {
[php.ObjectName]: 'O',
},
})
const steel = new User({ name: 'Steel Brain', age: 17 })
const serialized = php.stringify(steel)
console.log(serialized)
const deserialized = php.parse('...', { strict: false }) // won't parse serializable class with default strict=true
export declare function parse(
item: any,
{
strict = true,
encoding = 'utf-8',
}: {
strict: boolean
encoding: 'utf-8' | 'binary'
} = {},
): string
export declare function stringify(item: string | Buffer): any
export declare const ObjectName: unique symbol
php serialized object "O:1:"A":1:{...}" will be parsed to object with symbol name { {php.ObjectName]: "A", ... }
js Object with symbol as object name { {php.ObjectName]: "A" } will be serialized to php object "O:1:"A":1:{...}"
This project is licensed under the terms of MIT License. See the License file for more info.
FAQs
PHP serialize/deserialize in Javascript
The npm package @trim21/php-serialize receives a total of 357 weekly downloads. As such, @trim21/php-serialize popularity was classified as not popular.
We found that @trim21/php-serialize demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?

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.

Security News
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.

Security News
Open source is under attack because of how much value it creates. It has been the foundation of every major software innovation for the last three decades. This is not the time to walk away from it.

Security News
Socket CEO Feross Aboukhadijeh breaks down how North Korea hijacked Axios and what it means for the future of software supply chain security.