1764916648
markdown-44de2854e2769dfc43e2d6df118d39ee2b844756
s:2189:"<h1>VarExporter Component</h1>
<p>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 (<code>__wakeup</code>, <code>__sleep</code>, <code>Serializable</code>,
<code>__serialize</code>, <code>__unserialize</code>).</p>
<p>It also provides an instantiator that allows creating and populating objects
without calling their constructor nor any other methods.</p>
<p>The reason to use this component <em>vs</em> <code>serialize()</code> or
<a href="https://github.com/igbinary/igbinary">igbinary</a> is performance: thanks to
OPcache, the resulting code is significantly faster and more memory efficient
than using <code>unserialize()</code> or <code>igbinary_unserialize()</code>.</p>
<p>Unlike <code>var_export()</code>, this works on any serializable PHP value.</p>
<p>It also provides a few improvements over <code>var_export()</code>/<code>serialize()</code>:</p>
<ul>
<li>the output is PSR-2 compatible;</li>
<li>the output can be re-indented without messing up with <code>\r</code> or <code>\n</code> in the data</li>
<li>missing classes throw a <code>ClassNotFoundException</code> instead of being unserialized to
<code>PHP_Incomplete_Class</code> objects;</li>
<li>references involving <code>SplObjectStorage</code>, <code>ArrayObject</code> or <code>ArrayIterator</code>
instances are preserved;</li>
<li><code>Reflection*</code>, <code>IteratorIterator</code> and <code>RecursiveIteratorIterator</code> classes
throw an exception when being serialized (their unserialized version is broken
anyway, see <a href="https://bugs.php.net/76737">https://bugs.php.net/76737</a>).</li>
</ul>
<h2>Resources</h2>
<ul>
<li><a href="https://symfony.com/doc/current/components/var_exporter.html">Documentation</a></li>
<li><a href="https://symfony.com/doc/current/contributing/index.html">Contributing</a></li>
<li><a href="https://github.com/symfony/symfony/issues">Report issues</a> and
<a href="https://github.com/symfony/symfony/pulls">send Pull Requests</a>
in the <a href="https://github.com/symfony/symfony">main Symfony repository</a></li>
</ul>";