Skip to content

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 the packages the application uses in production:

composer require \
  stellarwp/foundation-container \
  stellarwp/foundation-log \
  stellarwp/foundation-lock

Add other components as the application needs them rather than installing integrations speculatively.

The CLI package generates project code. Install it for development and exclude it from production WordPress plugin ZIPs:

composer require --dev stellarwp/foundation-cli

Build production archives from a clean staging directory with development dependencies excluded:

composer install --no-dev --classmap-authoritative

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.

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:

composer require stellarwp/foundation

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’s generated autoloader from the application entrypoint before constructing the container or registering providers:

<?php declare(strict_types=1);

require_once __DIR__ . '/vendor/autoload.php';

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.