Install Foundation
Foundation requires PHP 8.3 or newer. Projects should generally install the split packages they use, with runtime components in require and developer tooling in require-dev.
Install runtime components
Section titled “Install runtime components”Install the packages the application uses in production:
Add other components as the application needs them rather than installing integrations speculatively.
Install developer tooling separately
Section titled “Install developer tooling separately”The CLI package generates project code. Install it for development and exclude it from production WordPress plugin ZIPs:
Build production archives from a clean staging directory with development dependencies excluded:
Check the resulting plugin ZIP contains neither the stellarwp/foundation-cli package nor its vendor/bin/foundation binary. Shared dependencies remain when required by runtime packages. Shipped WP-CLI commands are operational functionality: require stellarwp/foundation-wpcli normally when your plugin uses them.
Deliberately choose the aggregate package
Section titled “Deliberately choose the aggregate package”The aggregate includes CLI in production, even with --no-dev. Use split packages for distributable plugin ZIPs.
For an environment that intentionally keeps every component and developer tooling, install the aggregate:
This provides every runtime component and the developer CLI at vendor/bin/foundation. It is convenient for a complete application or development environment, but it is not the lean installation path for a distributable WordPress plugin.
Load Composer before Foundation
Section titled “Load Composer before Foundation”Load Composer’s generated autoloader from the application entrypoint before constructing the container or registering providers:
WordPress projects may use a build tool such as Strauss to prefix production dependencies. That packaging step does not change which Foundation packages belong in require or require-dev.