The VarExporter component allows exporting any serializable PHP data structure to plain PHP code.

Overview

VarExporter Component

The VarExporter component allows exporting any serializable PHP data structure to plain PHP code. While doing so, it preserves all the semantics associated with the serialization mechanism of PHP (__wakeup, __sleep, Serializable, __serialize, __unserialize).

It also provides an instantiator that allows creating and populating objects without calling their constructor nor any other methods.

The reason to use this component vs serialize() or igbinary is performance: thanks to OPcache, the resulting code is significantly faster and more memory efficient than using unserialize() or igbinary_unserialize().

Unlike var_export(), this works on any serializable PHP value.

It also provides a few improvements over var_export()/serialize():

  • the output is PSR-2 compatible;
  • the output can be re-indented without messing up with \r or \n in the data
  • missing classes throw a ClassNotFoundException instead of being unserialized to PHP_Incomplete_Class objects;
  • references involving SplObjectStorage, ArrayObject or ArrayIterator instances are preserved;
  • Reflection*, IteratorIterator and RecursiveIteratorIterator classes throw an exception when being serialized (their unserialized version is broken anyway, see https://bugs.php.net/76737).

Resources

You might also like...
Melek Berita Backend is a service for crawling data from various websites and processing the data to be used for news data needs.

About Laravel Laravel is a web application framework with expressive, elegant syntax. We believe development must be an enjoyable and creative experie

PHP functions that help you validate structure of complex nested PHP arrays.

PHP functions that help you validate structure of complex nested PHP arrays.

CMS based on Phalcon PHP Framework with modular structure

Yona CMS Yona CMS - open source content management system (CMS). Written in Phalcon PHP Framework (version 3.x supported) Has a convenient modular str

this is a PHP framework like Laravel based on MVC structure

PHP-MVC-framework v 1-0-0 this is a PHP framework like Laravel based on MVC structure The "App" folder is the main part of this framework Models, View

A layout field that forces translations to have the same structure.
A layout field that forces translations to have the same structure.

Kirby translatedlayout plugin A layout field that forces translations to have anidentical structure to the one of the default language. This is an exp

Developer-friendly framework heavily inspired by Laravel and based on Timber and Wpemerge solutions for WordPress themes development with Bedrock folder structure

Lightweight Brocooly (Brocket) Improved Controllers, Middleware and Routers, but slightly less powerful Container Open beta. Package in development Cr

Admidio is a free open source user management system for websites of organizations and groups. The system has a flexible role model so that it’s possible to reflect the structure and permissions of your organization.
Admidio is a free open source user management system for websites of organizations and groups. The system has a flexible role model so that it’s possible to reflect the structure and permissions of your organization.

Admidio Admidio is a free open source user management system for websites of organizations and groups. The system has a flexible role model so that it

Free ZIP Code API - Free Access to Worldwide Postal Code Data

About Zipcodebase - Free Zip Code API Zipcodebase is a zip code API that was founded in 2019 to solve common issues with postal code data. As we have

Allows Admins to quickly login as any user in the system during development/testing
Allows Admins to quickly login as any user in the system during development/testing

SilverStripe User Switcher The module adds a small form both in the frontend to quickly login as any user in the system. The intended use is in testin

Releases(v6.2.3)
  • v6.2.3(Dec 28, 2022)

    Changelog (https://github.com/symfony/var-exporter/compare/v6.2.2...v6.2.3)

    • bug #48724 Fix exporting classes with __unserialize() but not __serialize() (fancyweb)
    • bug #48742 Generate proxies for static abstract methods (nicolas-grekas)
    Source code(tar.gz)
    Source code(zip)
  • v6.1.9(Dec 28, 2022)

    Changelog (https://github.com/symfony/var-exporter/compare/v6.1.8...v6.1.9)

    • bug #48724 Fix exporting classes with __unserialize() but not __serialize() (fancyweb)
    Source code(tar.gz)
    Source code(zip)
  • v6.0.17(Dec 28, 2022)

    Changelog (https://github.com/symfony/var-exporter/compare/v6.0.16...v6.0.17)

    • bug #48724 Fix exporting classes with __unserialize() but not __serialize() (fancyweb)
    Source code(tar.gz)
    Source code(zip)
  • v5.4.17(Dec 28, 2022)

    Changelog (https://github.com/symfony/var-exporter/compare/v5.4.16...v5.4.17)

    • bug #48724 Fix exporting classes with __unserialize() but not __serialize() (fancyweb)
    Source code(tar.gz)
    Source code(zip)
  • v6.2.2(Dec 16, 2022)

    Changelog (https://github.com/symfony/var-exporter/compare/v6.2.1...v6.2.2)

    • bug #48605 Fix adding a key to an uninitialized array (nicolas-grekas)
    • bug #48553 Fix calling parent::__wakeup() when unserializing with LazyProxyTrait (azjezz)
    Source code(tar.gz)
    Source code(zip)
  • v6.2.1(Dec 6, 2022)

    Changelog (https://github.com/symfony/var-exporter/compare/v6.2.0...v6.2.1)

    • bug #48461 Fix possible memory-leak when using lazy-objects (nicolas-grekas)
    Source code(tar.gz)
    Source code(zip)
  • v6.2.0(Nov 30, 2022)

  • v6.2.0-RC1(Nov 25, 2022)

    Changelog (https://github.com/symfony/var-exporter/compare/v6.2.0-BETA3...v6.2.0-RC1)

    • bug #48312 Improve partial-initialization API for ghost objects (nicolas-grekas)
    Source code(tar.gz)
    Source code(zip)
  • v6.2.0-BETA3(Nov 19, 2022)

    Changelog (https://github.com/symfony/var-exporter/compare/v6.2.0-BETA2...v6.2.0-BETA3)

    • bug #48209 Use array<property-name,Closure> for partial initialization of lazy ghost objects (nicolas-grekas)
    Source code(tar.gz)
    Source code(zip)
  • v6.2.0-BETA1(Oct 24, 2022)

    Changelog (https://github.com/symfony/var-exporter/compare/v6.1.6...v6.2.0-BETA1)

    • feature #47236 Generate lazy-loading virtual proxies for non-ghostable lazy services (nicolas-grekas)
    • feature #46751 Add trait to help implement lazy loading ghost objects (nicolas-grekas)
    • feature #46452 Add Hydrator::hydrate() and preserve PHP references when using it (nicolas-grekas)
    Source code(tar.gz)
    Source code(zip)
  • v6.1.3(Jul 29, 2022)

  • v6.0.10(Jun 26, 2022)

  • v5.4.10(Jun 26, 2022)

  • v4.4.43(Jun 26, 2022)

  • v6.1.1(Jun 9, 2022)

  • v6.1.0(May 27, 2022)

    Changelog (https://github.com/symfony/var-exporter/compare/v6.1.0-RC1...v6.1.0)

    • bug #46421 Deal with DatePeriod->include_end_date on PHP 8.2 (nicolas-grekas)
    Source code(tar.gz)
    Source code(zip)
  • v6.0.9(May 27, 2022)

    Changelog (https://github.com/symfony/var-exporter/compare/v6.0.8...v6.0.9)

    • bug #46421 Deal with DatePeriod->include_end_date on PHP 8.2 (nicolas-grekas)
    • bug #46167 Fix exporting DateTime objects on PHP 8.2 (nicolas-grekas)
    Source code(tar.gz)
    Source code(zip)
  • v5.4.9(May 27, 2022)

    Changelog (https://github.com/symfony/var-exporter/compare/v5.4.8...v5.4.9)

    • bug #46421 Deal with DatePeriod->include_end_date on PHP 8.2 (nicolas-grekas)
    • bug #46167 Fix exporting DateTime objects on PHP 8.2 (nicolas-grekas)
    Source code(tar.gz)
    Source code(zip)
  • v4.4.42(May 27, 2022)

    Changelog (https://github.com/symfony/var-exporter/compare/v4.4.41...v4.4.42)

    • bug #46421 Deal with DatePeriod->include_end_date on PHP 8.2 (nicolas-grekas)
    • bug #46167 Fix exporting DateTime objects on PHP 8.2 (nicolas-grekas)
    Source code(tar.gz)
    Source code(zip)
  • v6.1.0-RC1(May 14, 2022)

    Changelog (https://github.com/symfony/var-exporter/compare/v6.1.0-BETA2...v6.1.0-RC1)

    • bug #46167 Fix exporting DateTime objects on PHP 8.2 (nicolas-grekas)
    Source code(tar.gz)
    Source code(zip)
  • v6.1.0-BETA2(Apr 27, 2022)

    Changelog (https://github.com/symfony/var-exporter/compare/v6.1.0-BETA1...v6.1.0-BETA2)

    • bug #46170 Fix dumping enums on PHP 8.2 (nicolas-grekas)
    Source code(tar.gz)
    Source code(zip)
  • v6.0.8(Apr 27, 2022)

  • v5.4.8(Apr 27, 2022)

  • v4.4.41(Apr 27, 2022)

  • v6.1.0-BETA1(Apr 15, 2022)

    Changelog (https://github.com/symfony/var-exporter/compare/v6.0.7...v6.1.0-BETA1)

    • feature #45377 Bump minimum version of PHP to 8.1 (nicolas-grekas)
    Source code(tar.gz)
    Source code(zip)
  • v6.0.7(Apr 2, 2022)

    Changelog (https://github.com/symfony/var-exporter/compare/v6.0.6...v6.0.7)

    • bug #45891 Fix exporting objects with readonly properties (nicolas-grekas)
    Source code(tar.gz)
    Source code(zip)
  • v5.4.7(Apr 2, 2022)

    Changelog (https://github.com/symfony/var-exporter/compare/v5.4.6...v5.4.7)

    • bug #45891 Fix exporting objects with readonly properties (nicolas-grekas)
    Source code(tar.gz)
    Source code(zip)
  • v4.4.40(Apr 2, 2022)

    Changelog (https://github.com/symfony/var-exporter/compare/v4.4.39...v4.4.40)

    • bug #45891 Fix exporting objects with readonly properties (nicolas-grekas)
    Source code(tar.gz)
    Source code(zip)
  • v6.0.6(Mar 5, 2022)

  • v5.4.6(Mar 5, 2022)

A PHP component to convert HTML into a plain text format

html2text html2text is a very simple script that uses DOM methods to convert HTML into a format similar to what would be rendered by a browser - perfe

Jevon Wright 423 Dec 29, 2022
Perch Dashboard app for exporting content to (Kirby) text files and Kirby Blueprint files

toKirby Perch Dashboard app for exporting content to (Kirby) text files and Kirby Blueprint files. You can easily install and test it in a few steps.

R. Banus 4 Jan 15, 2022
PHP library that helps to map any input into a strongly-typed value object structure.

Valinor • PHP object mapper with strong type support Valinor is a PHP library that helps to map any input into a strongly-typed value object structure

Team CuyZ 873 Jan 7, 2023
YL MVC Structure (PHP MVC) is a pattern made in PHP used to implement user interfaces, data, and controlling logic.

YL MVC Structure (PHP MVC) is a pattern made in PHP used to implement user interfaces, data, and controlling logic. It is built based on the combination of ideas from the Yii framework and Laravel framework (yl).

Tan Nguyen 3 Jan 3, 2023
Tables migrations seeded with data according to the Algerian education system structure.

Laravel algerian education system structure If you are building a Learning Management System or a School Management System and targeting the Algerian

Elaborate Code 12 Oct 8, 2022
Decimal handling as value object instead of plain strings.

Decimal Object Decimal value object for PHP. Background When working with monetary values, normal data types like int or float are not suitable for ex

Spryker 16 Oct 24, 2022
A plain-language, step-by-step guide for the computer novice to build their own cloud.

This is a plain-language, step-by-step guide for the computer novice wanting to build their own cloud, looking to declare independence from Google and its ilk, to save on monthly hosting fees, or just learn a new skill.

Paul Knight 25 Nov 19, 2022
salah eddine bendyab 18 Aug 17, 2021
Track any ip address with IP-Tracer. IP-Tracer is developed for Linux and Termux. you can retrieve any ip address information using IP-Tracer.

IP-Tracer is used to track an ip address. IP-Tracer is developed for Termux and Linux based systems. you can easily retrieve ip address information using IP-Tracer. IP-Tracer use ip-api to track ip address.

Rajkumar Dusad 1.2k Jan 4, 2023