import{_ast,casa,oasi,ajaso}from"./chunks/framework.C2AwuPrQ.js";constu=JSON.parse('{"title":"Guide","description":"","frontmatter":{},"headers":[],"relativePath":"en/guide/index.md","filePath":"en/guide/index.md"}'),r={name:"en/guide/index.md"};functionn(s,e,l,h,c,d){returni(),a("div",null,[...e[0]||(e[0]=[o('<h1id="guide"tabindex="-1">Guide<aclass="header-anchor"href="#guide"aria-label="Permalink to “Guide”"></a></h1><divclass="warningcustom-block"><pclass="custom-block-titlecustom-block-title-default">WARNING</p><p>YouarereadingthedocumentationforStaticPHPv3.Thev2versionwillbedeprecatedafterthestablereleaseofv3.The3.0versioniscurrentlyinthealphastage,andyoucanviewthev2documentation<ahref="https://static-php.github.io/v2-docs/"target="_blank"rel="noreferrer">here</a>.</p></div><h2id="what-is-staticphp"tabindex="-1">WhatisStaticPHP?<aclass="header-anchor"href="#what-is-staticphp"aria-label="Permalinkto“WhatisStaticPHP?”"></a></h2><p>StaticPHPisabuildtoolthatcompilesthePHPinterpretertogetherwithanyextensionsyouneedintoasingleself-containedbinary.Thetargetsystemdoesn'tneedPHPoranyruntimelibrariesinstalled—justcopythebinaryandrunit.BuildstargetLinux,macOS,andWindows.</p><p>StaticPHPisn'tlimitedtoPHP.Builtonthesameinfrastructure,itcanalsocompilestandalonestaticbinariesforcommontoolslike<code>curl</code>,<code>pkg-config</code>,and<code>htop</code>—nodependenciesrequiredonthetargetmachine.Supportformoretools(including<code>openssl</code>andotherfrequently-usedCLIutilities)isplanned.</p><h2id="why-bother-with-a-static-php-binary"tabindex="-1">WhybotherwithastaticPHPbinary?<aclass="header-anchor"href="#why-bother-with-a-static-php-binary"aria-label="Permalinkto“WhybotherwithastaticPHPbinary?”"></a></h2><p>AtypicalPHPinstallationistightlycoupledtothesystem:youinstallPHP,thenextensions,thenspendtimedealingwithversionmismatchesacrossdistros.Astaticbinarysidestepsallofthat—whatyougetisasingleexecutablethatrunsonanymachineofthesamearchitecture,nosetuprequired.</p><p>Commonusecases:</p><ul><li><strong>DistributingCLItools</strong>—ShiptoolslikeComposer,PHPStan,oryourownCLIasasinglefile.Usersdon'tneedPHPinstalled.</li><li><strong>Leanercontainers</strong>—Replaceabloated<code>php:8.x</code>baseimagewithaminimalimage(oreven<code>FROMscratch</code>)carryingjustastaticbinary.</li><li><strong>Serverapplications</strong>—BuildastaticbinarywithFPMorFrankenPHPbakedin.Deploymentbecomesafilecopy,withnodependencyonthehostenvironment.</li></ul><h2id="phpmicro-ship-php-and-your-code-as-one-file"tabindex="-1">phpmicro:shipPHPandyourcodeasonefile<aclass="header-anchor"href="#phpmicro-ship-php-and-your-code-as-one-file"aria-label="Permalinkto“phpmicro:shipPHPandyourcodeasonefile”"></a></h2><p><ahref="https://micro.static-php.dev"target="_blank"rel="noreferrer">phpmicro</a>isathird-partyPHPSAPIthatStaticPHPsupportsoutofthebox.ItmergesthePHPinterpreterwithyour<code>.php</code>sourceor<code>.phar</code>archiveintoasingleself-extractingexecutable(<code>.sfx</code>).</p><divclass="language-"><buttontitle="CopyCode"class="copy"></button><spanclass="lang"></span><preclass="shikishiki-themesgithub-lightgithub-dark"style="--shiki-light:#24292e;--shiki-dark:#e1e4e8;--shiki-light-bg:#fff;--shiki-dark-bg:#24292e;"tabindex="0"dir="ltr"><code><spanclass="line"><span>micro.sfx+your-app.phar=your-app#onefile,zerodependencies</span></span></code></pre></div><p>ThisisidealfordistributingPHP-basedCLItools:theenduserjustgetsanordinaryexecutablewithnoideaPHPisinvolved.</p><h2id="improving-how-you-ship-and-deploy-php-projects"tabindex="-1">ImprovinghowyoushipanddeployPHPprojects<aclass="header-anchor"href="#impr