<spanclass="line"><spanstyle="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">composer</span><spanstyle="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> install</span></span></code></pre></div><p>If you don't have PHP or Composer installed, use the bundled setup script to install a self-contained runtime:</p><divclass="vp-code-group"><divclass="tabs"><inputtype="radio"name="group-134"id="tab-135"checked><labeldata-title="Linux / macOS"for="tab-135">Linux / macOS</label><inputtype="radio"name="group-134"id="tab-136"><labeldata-title="Windows"for="tab-136">Windows</label></div><divclass="blocks"><divclass="language-bash active"><buttontitle="Copy Code"class="copy"></button><spanclass="lang">bash</span><preclass="shiki shiki-themes github-light github-dark"style="--shiki-light:#24292e;--shiki-dark:#e1e4e8;--shiki-light-bg:#fff;--shiki-dark-bg:#24292e;"tabindex="0"dir="ltr"><code><spanclass="line"><spanstyle="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">bin/setup-runtime</span></span></code></pre></div><divclass="language-powershell"><buttontitle="Copy Code"class="copy"></button><spanclass="lang">powershell</span><preclass="shiki shiki-themes github-light github-dark"style="--shiki-light:#24292e;--shiki-dark:#e1e4e8;--shiki-light-bg:#fff;--shiki-dark-bg:#24292e;"tabindex="0"dir="ltr"><code><spanclass="line"><spanstyle="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">.\bin\setup</span><spanstyle="--shiki-light:#D73A49;--shiki-dark:#F97583;">-</span><spanstyle="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">runtime.ps1</span></span>
<spanclass="line"><spanstyle="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">.\bin\setup</span><spanstyle="--shiki-light:#D73A49;--shiki-dark:#F97583;">-</span><spanstyle="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">runtime.ps1 </span><spanstyle="--shiki-light:#005CC5;--shiki-dark:#79B8FF;">add-path</span><spanstyle="--shiki-light:#6A737D;--shiki-dark:#6A737D;"> # add runtime/ to PATH</span></span></code></pre></div></div></div><p>The script downloads <code>php</code> and <code>composer</code> into a <code>runtime/</code> subdirectory. You then have two options:</p><ol><li><p><strong>Call them directly</strong> (no PATH changes needed):</p><divclass="language-bash"><buttontitle="Copy Code"class="copy"></button><spanclass="lang">bash</span><preclass="shiki shiki-themes github-light github-dark"style="--shiki-light:#24292e;--shiki-dark:#e1e4e8;--shiki-light-bg:#fff;--shiki-dark-bg:#24292e;"tabindex="0"dir="ltr"><code><spanclass="line"><spanstyle="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">runtime/php</span><spanstyle="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> bin/spc</span><spanstyle="--shiki-light:#005CC5;--shiki-dark:#79B8FF;"> --help</span></span>
<spanclass="line"><spanstyle="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">runtime/php</span><spanstyle="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> runtime/composer</span><spanstyle="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> install</span></span></code></pre></div></li><li><p><strong>Add <code>runtime/</code> to your PATH</strong> so you can use <code>php</code>, <code>composer</code>, and <code>bin/spc</code> without prefixes:</p><divclass="language-bash"><buttontitle="Copy Code"class="copy"></button><spanclass="lang">bash</span><preclass="shiki shiki-themes github-light github-dark"style="--shiki-light:#24292e;--shiki-dark:#e1e4e8;--shiki-light-bg:#fff;--shiki-dark-bg:#24292e;"tabindex="0"dir="ltr"><code><spanclass="line"><spanstyle="--shiki-light:#D73A49;--shiki-dark:#F97583;">export</span><spanstyle="--shiki-light:#24292E;--shiki-dark:#E1E4E8;"> PATH</span><spanstyle="--shiki-light:#D73A49;--shiki-dark:#F97583;">=</span><spanstyle="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">"/path/to/static-php-cli/runtime:</span><spanstyle="--shiki-light:#24292E;--shiki-dark:#E1E4E8;">$PATH</span><spanstyle="--shiki-light:#032F62;--shiki-dark:#9ECBFF;">"</span></span>
<spanclass="line"><spanstyle="--shiki-light:#6A737D;--shiki-dark:#6A737D;"># Add this to ~/.bashrc or ~/.zshrc to make it permanent</span></span></code></pre></div></li></ol><h2id="vendor-mode"tabindex="-1">Vendor mode <aclass="header-anchor"href="#vendor-mode"aria-label="Permalink to “Vendor mode”"></a></h2><p>If you already have a PHP project and want to call StaticPHP's build APIs directly, or use a custom registry to support private libraries and extensions, pull it in as a Composer dependency:</p><divclass="language-bash"><buttontitle="Copy Code"class="copy"></button><spanclass="lang">bash</span><preclass="shiki shiki-themes github-light github-dark"style="--shiki-light:#24292e;--shiki-dark:#e1e4e8;--shiki-light-bg:#fff;--shiki-dark-bg:#24292e;"tabindex="0"dir="ltr"><code><spanclass="line"><spanstyle="--shiki-light:#6F42C1;--shiki-dark:#B392F0;">composer</span><spanstyle="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> require</span><spanstyle="--shiki-light:#032F62;--shiki-dark:#9ECBFF;"> crazywhalecc/static-php-cli</span></span></code></pre></div><p>See the <ahref="./../develop/extending/">Extending StaticPHP</a> guide for details.</p><h2id="verify-your-build-environment"tabindex="-1">Verify your build environment <aclass="header-anchor"href="#verify-your-build-environment"aria-label="Permalink to “Verify your build environment”"></a></h2><blockquote><p><strong>Vendor mode users can skip this step.</strong></p></blockquote><p>Once installed, run <code>doctor</code> to check that your system has the required build tools (cmake, make, a C compiler, etc.):</p><divclass="language-bash"><buttontitle="Copy Code"class="copy"></button><spanclass="lang">bash</span><preclass="shiki shiki-themes github-light github-dark"style="--shiki-light:#24292e;--shiki-dark:#e1e4e8;--shiki-light-bg:#fff;--shiki-dark-bg:#24292e;"tabindex="0"dir="ltr"><code><spanclass="line"><spanstyle="--shiki-light:#6A737D;--shiki-dark:#6A737D;"># Using the spc binary</span></span>