Security News
Cloudflare Adds Security.txt Setup Wizard
Cloudflare has launched a setup wizard allowing users to easily create and manage a security.txt file for vulnerability disclosure on their websites.
php-serialize
Advanced tools
It also supports Serializable
objects decode. Here's how you can use them.
import {serialize, unserialize} from '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(steel)
const unserialized = unserialize(serialized, { User: User }) // Passing available classes
console.log(unserialized instanceof User) // true
const serializedForNamespace = serialize(steel, {
'MyApp\\User': User,
})
// ^ Above code will serialize User class to given name
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
This project is licensed under the terms of MIT License. See the License file for more info.
4.1.1
Map
support for multiple elements (Thanks @trim21)FAQs
PHP serialize/unserialize in Javascript
We found that php-serialize demonstrated a healthy version release cadence and project activity because the last version was released less than 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
Cloudflare has launched a setup wizard allowing users to easily create and manage a security.txt file for vulnerability disclosure on their websites.
Security News
The Socket Research team breaks down a malicious npm package targeting the legitimate DOMPurify library. It uses obfuscated code to hide that it is exfiltrating browser and crypto wallet data.
Security News
ENISA’s 2024 report highlights the EU’s top cybersecurity threats, including rising DDoS attacks, ransomware, supply chain vulnerabilities, and weaponized AI.