Copied!

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().

CloneableFinalInstantiable
Methods
public static export(?mixed $value, ?bool $isStaticValue = NULL, array $foundClasses = []) : string
 

Exports a serializable PHP value to PHP code.

  • param bool $isStaticValue Set to true after execution if the provided value is static, false otherwise
  • param array $foundClasses Classes found in the value are added to this list as both keys and values
  • throws \ExceptionInterface When the provided value cannot be serialized
Methods
public static export(?mixed $value, ?bool $isStaticValue = NULL, array $foundClasses = []) : string
 

Exports a serializable PHP value to PHP code.

  • param bool $isStaticValue Set to true after execution if the provided value is static, false otherwise
  • param array $foundClasses Classes found in the value are added to this list as both keys and values
  • throws \ExceptionInterface When the provided value cannot be serialized
© 2024 Bruce Wells
Search Namespaces \ Classes
Configuration