class VarExporter

Exports serializable PHP values to PHP code.

VarExporter allows serializing PHP data structures to plain PHP code (like var_export()) while preserving all the semantics associated with serialize() (unlike var_export()).

By leveraging OPcache, the generated PHP code is faster than doing the same with unserialize().

Methods

static string
export(mixed$value,bool$isStaticValue =null,array$foundClasses =[])

Exports a serializable PHP value to PHP code.

Details

staticstring export(mixed$value,bool$isStaticValue =null,array$foundClasses =[])

Exports a serializable PHP value to PHP code.

Parameters

mixed $value
bool $isStaticValue
array $foundClasses

Return Value

string

Exceptions

ExceptionInterface When the provided value cannot be serialized