The slic (StellarWP Local Interactive Containers) CLI command provides a containerized and consistent environment for running automated tests.
One of the biggest stumbling blocks that engineers face when getting automated testing going for their projects is the complexity of setting up a testing environment. And as your team size grows, the struggles with consistent test running increase.
slic automatically configures a Codeception testing environment so you don't have to.
Plus, it provides a lot of handy development tools and utilities that you can use while developing your project or during Continuous Integration builds!
Codeception is a PHP testing framework that uses PHPUnit under the hood, adding all sorts of extra features to make testing PHP much easier. By using Codeception, you then get the ability to use wp-browser, a module that greatly simplifies testing WordPress plugins, themes, and whole WP sites at all levels of testing.
» Learn more about wp-browser here and get it set up on your project.
You can see examples of what to toss in your
composer.jsonin our stellarwp/schema repository.
Docker.
That's the only prerequisite. Get that installed and running on your machine and you'll be good to go!
These instructions are assuming that you are cloning the
slicrepository in~/projects. If you want it in a different location, feel free to tweak the example commands below.
cd ~/projects
git clone git@github.com:stellarwp/slic.gitAssuming you are cloning the slic repository in ~/projects:
echo "export PATH=$HOME/projects/slic:$PATH" >> ~/.bashrc
source ~/.bashrcIf you are using zsh, change
~/.bashrcto~/.zshrc.
slic is well documented within the CLI utility itself. To see all of the available commands, run:
slic helpYou can see details and usage on each command by running:
slic help <command>Working with Multiple Stacks: Most
sliccommands support a global--stack=<path>flag to target a specific stack. See Working with Multiple Stacks for details.
The slic command has many subcommands. You can discover what those are by typing slic or slic help. If you want
more details on any of the subcommands, simply type: slic [subcommand] help.
The slic command needs a place to look for plugins, themes, and WordPress. By default, slic creates a _wordpress directory within the local checkout of slic, and a _plugins directory in the directory it runs in: a relative SLIC_PLUGINS_DIR, the default ./_plugins included, is resolved from there, so run from the checkout it is inside it. In most cases, however, developers like to run automated tests against the paths where they are actively working on code – which likely lives elsewhere.
Good news! You can use the slic here sub-command to create a stack that points to the directories you want to work with.
What's a stack? A stack is an isolated slic environment with its own containers, configuration, and ports. You can have multiple stacks running simultaneously, allowing you to work on different projects or WordPress installations without conflicts.
There are two locations you can tell slic to look.
If you want to defer all of the WP site configuration to a dynamically pulled codebase and just worry about testing
plugins, you can run the slic here command right from the parent directory of your project. Doing so will restrict slic to running tests on subdirectories of where you ran the command.
Example:
# Change to your plugin containing dir (likely some path to wp-content/plugins)
cd /path/to/your/wp-content/plugins
slic hereThis creates a new stack for this directory. If you already have a stack for this directory, it updates the configuration.
If you are developing a theme, run slic here from your themes directory. slic will detect that it is pointed at a themes directory and correctly:
- Mount the directory as
wp-content/themes/in the Docker stack so your theme is available to WordPress as a real theme. - Keep a separate plugins directory (
SLIC_PLUGINS_DIR) so dependencies like WooCommerce install intowp-content/plugins/and not into your themes directory. - Run Codeception from within the correct
wp-content/themes/<theme>path inside the container.
Example:
# Change to your themes directory
cd /path/to/your/wp-content/themes
slic here
slic use my-theme
slic run wpunitWPLoader suite config: When testing a theme, activate it via the WPLoader
theme:key rather than listing it underplugins/activatePlugins. WordPress will then load the theme (including itsfunctions.php) automatically.modules: config: WPLoader: plugins: - woocommerce/woocommerce.php activatePlugins: - woocommerce/woocommerce.php theme: my-theme # ← activates the theme under test
The third option is to navigate to the root of your site (likely where wp-config.php lives) and run the slic here
command.
Note: This is an opinionated option and there are some assumptions that are made:
- That the WordPress directory is the path you are indicating or in a sub-directory called
wp/.- That the
wp-content/(orcontent/) directory is a sub-directory of the location in which you are typingslic here.
# Change to your root directory of your site (where your wp-config.php file lives)
cd /path/to/your/site
slic hereBy running slic here at the site level, this allows you to set plugins, themes, or the site itself as the location
from which to run tests. This also has the benefit of running tests within the WP version that your site uses.
slic here mounts the complete site root at /var/www/html. WordPress core remains at /var/www/html/wp when the
project installs it in wp/, while root installations remain at /var/www/html. The detected content/ or
wp-content/ directory is mounted at the matching container path.
When a project installs WordPress in wp/, selecting an individual plugin or theme uses Slic's isolated WordPress
installation instead. This preserves existing component test configurations that expect core at /var/www/html.
Plugin targets use Slic's bundled default themes, while theme targets mount the project's themes directory. Selecting
site switches back to the complete project root. Slic recreates running PHP containers when these mounts change and
leaves the database and other services running.
slic here also disables subdirectory builds for sites and enables them for plugin and theme directories. You can
override the detected setting with slic build-subdir on|off.
Each stack runs in complete isolation with its own:
- Docker containers (separate from other stacks)
- MySQL database instance
- Redis cache
- WordPress container
Important Note: While each stack has its own WordPress container, the WordPress codebase itself may be shared among containers. If you're using the default _wordpress directory inside slic (when running slic here from a plugins directory), all stacks will share the same WordPress installation files. However, each stack maintains its own database and Redis cache, so data remains isolated.
Ports are automatically assigned by Docker when containers start. You don't need to configure or worry about port conflicts – Docker handles this for you. You can view the assigned ports for any stack using:
slic using # Show current stack and its ports
slic stack list # Show all stacks and their ports
slic stack info # Show detailed info for current stackBefore you can do anything productive with slic, you need to tell it which
project you wish to use and then you can initialize the project, run tests, and
execute other commands to your heart's content!
The slic use command offers two ways to select your target:
When you run slic use without any arguments, it opens an interactive Terminal User Interface (TUI) that lets you browse and select from available targets:
slic useThis launches an interactive menu with these features:
- Browse targets: Navigate through all available plugins/themes with arrow keys (↑↓)
- Fuzzy search: Type to filter targets instantly (case-insensitive substring matching)
- Current target indicator: See which target is currently active (marked with ✓)
- Scroll indicators: Visual cues when there are more items above/below the visible window
- Keyboard controls:
↑↓Arrow keys to navigate- Type to filter/search
Enterto selectESCorCtrl+Cto cancel
- Cross-platform: Works on Windows, macOS, and Linux
The interactive mode is especially helpful when:
- You're not sure of the exact target name
- You want to see all available options at once
- You need to quickly switch between targets
If you already know which target you want, you can specify it directly:
slic use the-events-calendarThis immediately switches to the specified target without showing the interactive menu.
For more information on this command, run
slic help use.
With your desired plugin containing directory set, you will need to initialize plugins so that they are prepped and ready
for slic-based automated test running. You do that using slic init [plugin].
Example:
slic init event-ticketsWhat this command does:
- Generates a
.env.testing.slicenv file in the plugin. - Generates a
test-config.slic.phpfile in the plugin. - Generates a
codeception.slic.ymlfile in the plugin. - Prompts for confirmation on running
composerandnpminstalls on the plugin.
slic supports running multiple isolated stacks simultaneously. This is useful when you're working on multiple projects, need different WordPress versions, or want to test against different configurations.
When you run a slic command, it determines which stack to use in this priority order:
--stack=<path>flag - Explicitly specify the stack to useSLIC_STACKenvironment variable - Set programmatically for CI or scripts- Current working directory - Automatically uses the stack that matches your current directory
- Single stack fallback - If only one stack exists, uses it automatically
To see all your registered stacks with their configuration and ports:
slic stack listThis shows:
- Stack directory path
- Current target (which plugin/project is active)
- WordPress URL and assigned port
- MySQL and Redis ports
- Container status
To see detailed information about the stack you're currently using:
slic usingThis displays:
- Current target plugin/project
- Stack directory
- WordPress URL and all port assignments
- Whether your current directory matches the active target
For even more details:
slic stack infoTo stop containers for a specific stack without affecting others:
slic stack stop /path/to/your/pluginsIf you have multiple stacks and don't specify which one, slic will show you a list to choose from.
To stop all registered stacks at once:
slic stack stop allThis command:
- Shows a list of all stacks that will be stopped
- Prompts for confirmation before proceeding
- Stops each stack even if one fails
- Shows a comprehensive summary with success/failure counts
- Works from any directory
Options:
-y, --yes- Skip confirmation prompt and proceed immediately
Examples:
slic stack stop all # Interactive - prompts for confirmation
slic stack stop all -y # Non-interactive - stops all stacks immediately
slic stack stop all --yes # Same as -yCaution: Use -y carefully in automation scripts. It bypasses all confirmations and will immediately stop and remove all registered stacks.
Note: This command requires interactive input to confirm the action unless the -y flag is provided. It will exit with an error when run in non-interactive environments (such as CI pipelines or automation scripts) without the -y flag.
This is useful when you want to free up system resources or restart your Docker environment cleanly.
Each stack has its own Docker network. A stack whose containers stopped without slic stop, as when Docker or the machine restarted, keeps its network, and enough of those use up the networks Docker can create: starting a stack then fails with "all predefined address pools have been fully subnetted". To free them:
slic stack pruneIt removes the containers and networks of every stack with no running container, and leaves running stacks as they are. Volumes, the registered stacks and their settings are kept, so slic start recreates a pruned stack.
When working with multiple stacks, you can target a specific one in two ways:
Option 1: Change to the stack directory
cd /path/to/project-a/wp-content/plugins
slic run wpunit # Runs tests in project-a's stackOption 2: Use the --stack flag
slic --stack=/path/to/project-a/wp-content/plugins run wpunitThe --stack flag works with any slic command:
# Use a different stack
slic --stack=/path/to/project-b/wp-content/plugins use my-plugin
# Run composer in a specific stack
slic --stack=/path/to/project-a/wp-content/plugins composer install
# View logs from a specific stack
slic --stack=/path/to/project-b/wp-content/plugins logsUnlike earlier versions of slic, you no longer need to configure ports. Docker automatically assigns available ports when containers start, preventing conflicts when running multiple stacks.
To find your stack's ports:
# Quick view
slic using
# Detailed view
slic stack info
# All stacks
slic stack listThe WordPress site will be accessible at http://localhost:<auto-assigned-port> where the port is shown by these commands.
Here's a typical workflow when working on multiple projects:
# Create stack for project A
cd ~/projects/client-a/wp-content/plugins
slic here
slic use their-plugin
# Create stack for project B
cd ~/projects/client-b/wp-content/plugins
slic here
slic use another-plugin
# Work on project A from anywhere
slic --stack=~/projects/client-a/wp-content/plugins run wpunit
# Or cd to project A and work normally
cd ~/projects/client-a/wp-content/plugins/their-plugin
slic run wpunit # Automatically uses project A's stack
# Switch to project B
cd ~/projects/client-b/wp-content/plugins/another-plugin
slic shell # Opens shell in project B's stack
# View all your stacks
slic stack listEach stack gets its own unique XDebug configuration to enable debugging multiple stacks simultaneously without conflicts. This is achieved through stack-specific XDebug ports and server names.
How Stack-Specific XDebug Works:
When you create a stack with slic here, slic automatically generates:
- A unique XDebug port in the range 49000-59000
- A unique server name in the format
slic_{hash}
Both are deterministically generated from your stack path using an MD5 hash, so they remain consistent across restarts.
Viewing Your Stack's XDebug Configuration:
To see your stack's XDebug settings, run:
slic xdebug statusThis displays:
- XDebug status (on/off)
- Remote host and port
- IDE key (server name)
- Path mappings for your IDE
Why This Matters:
With stack-specific XDebug configuration, you can:
- Debug tests running in multiple stacks at the same time
- Keep separate IDE debug configurations for each project
- Avoid port conflicts when multiple stacks are active
Example:
If you create stacks for two different projects:
# Stack A at ~/projects/client-a/wp-content/plugins
cd ~/projects/client-a/wp-content/plugins
slic here
slic xdebug status
# Shows: IDE Key: slic_a7f3c891, Remote port: 52341
# Stack B at ~/projects/client-b/wp-content/plugins
cd ~/projects/client-b/wp-content/plugins
slic here
slic xdebug status
# Shows: IDE Key: slic_b8d4e902, Remote port: 54782Each stack has different port numbers and server names based on their paths. This means you can run tests with debugging enabled in both stacks simultaneously, as long as your IDE has separate debug configurations for each (using their respective ports and server names).
For detailed instructions on configuring your IDE for XDebug, see Configuring IDEs for Xdebug.
If you were using slic before multi-stack support was added, your existing configuration is automatically migrated the first time you run a slic command. Your original .env.slic.run file is backed up as .env.slic.run.backup and a new stack is registered for your configuration.
The migration is seamless – you can continue using slic exactly as before, and when you're ready, you can create additional stacks for other projects.
slic supports git worktrees for concurrent development workflows. Each worktree automatically gets its own isolated Docker Compose stack with unique XDebug ports, allowing you to work on multiple branches of the same plugin simultaneously without switching context.
Git worktree support is ideal for:
- Parallel feature development - Work on multiple features in the same plugin at once
- Pull request reviews - Test and review PRs without losing your current work
- Bug fixes while developing - Quickly switch to a hotfix without disrupting your feature branch
- Cross-branch testing - Compare behavior across different branches side-by-side
- Concurrent client work - Handle urgent fixes while keeping long-running features in progress
When you create a worktree with slic, it:
- Creates a new git worktree in a parallel directory (following git's standard naming convention)
- Automatically registers a new slic stack for that worktree
- Assigns a unique XDebug port (in the 49000-59000 range)
- Links the worktree stack to the base stack (shown hierarchically in
slic stack list) - Maintains complete stack isolation while sharing the WordPress installation files
Important: Each worktree stack shares the same WordPress codebase as the base stack, but runs in its own isolated Docker containers, with its own database and its own ports.
To create a new worktree for your current plugin:
cd /path/to/plugins/the-events-calendar
slic worktree add feature/my-new-featureThis creates:
- A new git worktree at
../the-events-calendar-feature-my-new-feature/ - A dedicated slic stack with format
base-stack@worktree-dir - A unique XDebug port for isolated debugging
When slic creates the worktree, it branches from the commit the plugin's checkout is on.
The worktree directory name follows git's convention: the plugin name followed by the branch name with slashes replaced by hyphens.
To see all worktrees for your current plugin:
slic worktree listThis displays a table showing:
- Branch name
- Full path to the worktree
- Associated slic stack name
- XDebug port assignment
- Whether the stack is currently active
Simply navigate to the worktree directory:
cd ../the-events-calendar-feature-my-new-feature
slic run wpunit # Automatically uses the worktree's stackOr use the --stack flag from anywhere:
slic --stack=/path/to/worktree run wpunitWhen you're done working on a feature branch, merge it back and clean up:
# From the base stack directory (not the worktree directory)
slic worktree merge fix/issue-123Important: This command must be run from the base stack directory, not from within the worktree directory being merged. The worktree directory will be removed by git during the merge process.
The merge command will:
- Checkout the base branch, the branch the target repository was on when the worktree was registered
- Merge the worktree branch into the base branch
- Stop Docker containers
- Remove the git worktree directory
- Delete the local worktree branch
- Unregister the slic stack
If the target repository was on a detached HEAD when the worktree was registered, there is no base branch to merge into: the command stops without changing anything, and you merge with git yourself.
Use -y or --yes to skip confirmation prompts:
slic worktree merge fix/issue-123 -yIf the merge encounters conflicts, the command stops and leaves the target repository mid-merge, as git does, with the worktree and its stack in place. Resolve and commit, then run the command again, or abort with git -C <target> merge --abort.
To remove a worktree and clean up its slic stack:
slic worktree remove feature/my-new-featureName the worktree by the branch it was created for, as in slic worktree add.
This command:
- Stops the worktree's Docker containers and removes its network
- Removes the git worktree
- Unregisters the associated slic stack
If the worktree has uncommitted changes, the command asks before discarding them; -y discards them without asking.
Note: The command will fail, and keep the worktree and its stack, if:
- The worktree is currently locked (
git worktree unlockit first) - The worktree directory belongs to another branch, such as
feat/cforfeat-c
Over time, worktrees and stacks can become out of sync (e.g., if a worktree is manually deleted or a stack is removed). To detect and clean up orphaned resources:
slic worktree syncThis command:
- Detects orphaned worktree stacks of the current base stack (slic stack exists but git worktree doesn't)
- Detects unregistered worktrees (git worktree exists but slic stack doesn't)
- With
--clean, stops the containers of each orphaned stack and unregisters it - Offers to register unregistered worktrees
Run this periodically or whenever you suspect your worktrees and stacks are out of sync.
Each worktree stack:
- Has its own Docker Compose project name (e.g.,
slic_plugins_tec_feature_my_feature) - Gets a unique XDebug port (automatically allocated from 49000-59000)
- Runs in complete isolation with separate containers
- Shares the same WordPress installation files with the base stack, but has its own database
- Can run simultaneously with the base stack and other worktree stacks
Example XDebug configuration:
# In base stack
cd /path/to/plugins/the-events-calendar
slic xdebug status
# Shows: IDE Key: slic_a7f3c891, Remote port: 52341
# In worktree
cd ../the-events-calendar-feature-new-feature
slic xdebug status
# Shows: IDE Key: slic_b8d4e902, Remote port: 54782Each worktree can be debugged independently without port conflicts.
Worktree stacks are tied to their specific target directory and cannot switch targets using slic use. This is by design - each worktree represents a specific branch/feature context.
If you attempt to run slic use <target> in a worktree stack, you'll see an error explaining the restriction and suggesting to switch to the base stack:
cd ../the-events-calendar-feature-new-feature
slic use event-tickets
# Error: Cannot switch target in a worktree stack.
# Worktree stacks are tied to a specific target directory.
# To switch targets, use the base stack: cd /path/to/plugins && slic use event-ticketsTo work with a different target, switch back to your base stack first:
cd /path/to/plugins
slic use event-ticketsIf you navigate to a worktree directory that hasn't been registered with slic, the CLI will automatically detect it and offer to register it:
cd ../the-events-calendar-feature-some-feature
slic use the-events-calendar
# Detects unregistered worktree and prompts: "Register this worktree? (y/n)"This is useful when:
- Cloning a repository with existing worktrees
- Switching to a new machine
- Working with worktrees created by team members
To see your base stack and all associated worktree stacks in a tree structure:
slic stack listExample output:
┌─ /path/to/plugins
│ └─ Target: the-events-calendar
│ WordPress: http://localhost:52341
│
│ ┌─ Worktrees:
│ │ ├─ /path/to/plugins-feature-new-widget (feature/new-widget)
│ │ │ └─ XDebug: 54782
│ │ └─ /path/to/plugins-bugfix-123 (bugfix/123)
│ │ └─ XDebug: 55891
This view makes it easy to:
- See which worktrees exist for each base stack
- Identify XDebug ports for each worktree
- Understand the relationship between stacks
Here's a typical workflow using worktrees:
# Start with your main development branch
cd ~/projects/wp-content/plugins/the-events-calendar
slic use the-events-calendar
# Create a worktree for a new feature
slic worktree add feature/new-widget
cd ../the-events-calendar-feature-new-widget
# Work on the feature
slic run wpunit
slic shell
# Meanwhile, an urgent bug comes in
cd ~/projects/wp-content/plugins/the-events-calendar
slic worktree add bugfix/urgent-fix
cd ../the-events-calendar-bugfix-urgent-fix
# Fix the bug and test
slic run wpunit
# Both stacks are running simultaneously
slic stack list # See both worktrees
# When done, clean up
cd ~/projects/wp-content/plugins/the-events-calendar
slic worktree remove feature/new-widget
slic worktree remove bugfix/urgent-fixDo:
- Use
slic worktree listto see what worktrees you have before creating new ones - Run
slic worktree syncperiodically to keep things clean - Use descriptive branch names that clearly identify the purpose
- Remove worktrees when you're done with them to save disk space
Don't:
- Manually delete worktree directories (use
slic worktree removeinstead) - Create too many worktrees simultaneously (each consumes system resources)
- Forget to commit or push work before removing a worktree
Problem: slic worktree add fails with "worktree already exists"
Solution: Check git worktree list and either use the existing worktree or remove it first with slic worktree remove
Problem: Stack appears in slic stack list but worktree doesn't exist
Solution: Run slic worktree sync to clean up orphaned stacks
Problem: Worktree exists but stack isn't registered
Solution: Navigate to the worktree directory and run any slic command, which will prompt to register it, or run slic worktree sync
Problem: XDebug not working in worktree
Solution: Check slic xdebug status in the worktree directory to see the unique port, then configure your IDE with that port
As mentioned above, you'll need to use Codeception for your automated testing and it is highly recommended that you make use of wp-browser - which adds a lot of WordPress helper functions and utilities.
Ok. You have slic set up. It is pointing at your project. Your project has tests. Now you want to run one of your test suites. Let's pretend that your test suite is called wpunit.
You can run the full suite like so:
slic run wpunitOr, if you want an even more efficient way to do it, you can do:
slic shell
# You'll get a prompt once you are thrown into the shell
> cr wpunitFor projects with a Playwright suite, prepare your WordPress test site and run:
slic playwright testSee the Playwright guide for dependency installation, test examples, and how to adapt existing browser setup hooks to work with Slic.
By default, slic uses PHP 7.4, but you can easily switch between different PHP versions for your projects.
To see which PHP version slic is configured to use or if a version is staged:
slic php-versionIf you're working with a project and want to test it with a different PHP version, you can manually set the version:
slic php-version set 8.1This will set the PHP version to 8.1 and prompt you to rebuild the stack. This is useful when you want to test your project against a different PHP version than what's automatically detected.
For CI environments or when you want to pre-configure the PHP version before running slic use:
slic php-version set 8.4 --skip-rebuildThis stages the PHP version change for the next time you run slic use <project>, allowing you to avoid pulling Docker images multiple times.
When you run slic use <project>, slic will automatically detect and use the PHP version specified in:
- The project's
slic.jsonfile (using thephpVersionproperty) - The project's
composer.jsonfile (using theconfig.platform.phpproperty)
PHP versions are applied in the following priority order:
- Command line override:
SLIC_PHP_VERSION=8.3 slic use <project> - Staged version (from
slic php-version set <version> --skip-rebuild) - A Project's
.env.slic.localfile - Auto-detected version from project configuration
To reset slic to the default PHP version (7.4):
slic php-version resetslic provides tab completion for bash, zsh, and fish shells. This makes it faster to use slic by allowing you to press Tab to autocomplete commands, targets, branches, and options.
The easiest way to set up completions is:
slic completion installThis auto-detects your shell and installs the appropriate completion script. You'll be prompted to confirm before any files are modified.
Once installed, you can tab-complete:
- Commands:
slic <TAB>shows all available commands - Targets:
slic use <TAB>shows all valid plugins/themes - Subcommands:
slic stack <TAB>showslist,stop,info - Git branches:
slic worktree merge <TAB>andslic worktree remove <TAB>show available branches - Stack paths:
slic --stack=<TAB>shows registered stack paths - Toggle options:
slic xdebug <TAB>showson,off,status, etc. - PHP versions:
slic php-version set <TAB>shows7.4,8.0,8.1,8.2,8.3
If you prefer manual installation or the automatic installation doesn't work:
Bash - Add to ~/.bashrc or ~/.bash_profile:
# slic completions
if command -v slic &> /dev/null; then
_slic_path=$(command -v slic)
while [[ -L "$_slic_path" ]]; do
_slic_link=$(readlink "$_slic_path")
[[ "$_slic_link" == /* ]] || _slic_link="$(dirname "$_slic_path")/$_slic_link"
_slic_path=$_slic_link
done
source "$(dirname "$_slic_path")/completions/bash/slic.bash"
unset _slic_path _slic_link
fiZsh - Add to ~/.zshrc:
# slic completions
if command -v slic &> /dev/null; then
_slic_path=$(command -v slic)
while [[ -L "$_slic_path" ]]; do
_slic_link=$(readlink "$_slic_path")
[[ "$_slic_link" == /* ]] || _slic_link="$(dirname "$_slic_path")/$_slic_link"
_slic_path=$_slic_link
done
fpath=("$(dirname "$_slic_path")/completions/zsh" $fpath)
autoload -Uz compinit && compinit
unset _slic_path _slic_link
fiFish - Create a symlink:
mkdir -p ~/.config/fish/completions
ln -sf /path/to/slic/completions/fish/slic.fish ~/.config/fish/completions/slic.fish# Show installation instructions for your shell
slic completion
# Display the completion script content (for inspection or manual setup)
slic completion show [bash|zsh|fish]The completion system uses a two-layer architecture:
- Shell scripts (bash/zsh/fish) - Thin wrappers that capture the command line context
- PHP backend - Generates completions dynamically based on your slic configuration, on every Tab press, so new plugins, branches and stacks complete at once
By default, slic caches composer dependencies within the container
and, when the containers are destroyed, so is the cache. The good news
is that slic allows you to map your machine's composer cache directory into
the slic containers so that repeated slic composer commands can benefit from
the cache as well!
# Feel free to change the path to whatever is appropriate for your machine.
slic composer-cache set $HOME/.cache/composerFor more information on this topic, type slic help composer-cache.
By default, slic uses composer v1 but you may also choose to use v2 by running the following command:
slic composer set-version 2
If you need to go back, just set the version back to 1:
slic composer set-version 1
If you want to know which version slic is pointed at, you can always call:
slic composer get-version
If you need to install a private composer package, configure the COMPOSER_AUTH environment variable. For example, to install a package from a private GitHub repository:
Note: You may need to create a Personal Access Token.
export COMPOSER_AUTH='{"github-oauth": {"github.com": "YOUR_TOKEN_HERE"}}'Then, restart slic and try again:
slic restart; slic composer updateOr, in a GitHub Action, for example:
jobs:
test:
runs-on: ubuntu-latest
env:
COMPOSER_AUTH: '{"github-oauth": {"github.com": "${{ secrets.GH_BOT_TOKEN }}"}}'The slic CLI command leverages .env.* files to dictate its inner workings. It loads .env.* files in the following order, the later files overriding the earlier ones:
.env.slic- this is the default.envfile and should not be edited..env.slic.localin the main slic directory - this file doesn't exist by default. Make overrides to all your projects (e.g.SLIC_GIT_HANDLE) by creating it and adding lines to your heart's content..env.slic.run- this file is generated byslicand includes settings, shared by all stacks, that are set by specificsliccommands..env.slic.run.<hash>- generated byslic, one per stack: the stack's own settings, such as its target, PHP version and Xdebug port..env.slic.localin your target's directory - this file doesn't exist by default. Make overrides to a single project (e.g.SLIC_PHP_VERSION).
The target's .env.slic.local applies in full only inside the stack: when you run slic from the stack's directory, or name the stack with --stack or SLIC_STACK. When the stack is used from outside it, slic applies only the settings it reads itself, listed in slic_target_settings_read_from_outside() in src/utils.php, and ignores the settings that name host directories (SLIC_PLUGINS_DIR, SLIC_THEMES_DIR, SLIC_WP_DIR, COMPOSER_CACHE_DIR, SLIC_SCRIPTS and the like), printing a notice that names the ones it ignored.
List the available Xdebug commands.
See if Xdebug is enabled or disabled, the host information, and the path mapping to add to your IDE.
When working with multiple stacks, this command displays stack-specific XDebug configuration:
- The unique XDebug remote port for the current stack (range 49000-59000)
- The stack-specific IDE key/server name (format:
slic_<hash>) - Path mappings for your IDE
Each stack gets its own XDebug configuration, allowing you to debug tests running in multiple stacks simultaneously without port conflicts.
Note that this command cannot be ran within slic shell because you've SSH'd into the Codeception container which has no knowledge of slic.
See also: Configuring Xdebug
Xdebug can be toggled in both the wordpress and slic containers:
Global commands (requires container restart):
slic xdebug on- Enable Xdebug in both containersslic xdebug off- Disable Xdebug in both containers
When using these commands, slic will prompt you to restart the containers.
Within slic shell (takes effect immediately, no restart needed):
xon- Enable Xdebugxoff- Disable Xdebugpcovon- Enable PCOVpcovoff- Disable PCOV
PCOV can be toggled in both the wordpress and slic containers for faster coverage collection:
slic pcov on- Enable PCOV in both containersslic pcov off- Disable PCOV in both containersslic pcov status- Show the current PCOV status
The command sets the desired PCOV state and applies it to running containers immediately. Stopped containers pick up the configured state the next time they start. PCOV is disabled by default in the stack images and is intended for coverage runs, not day-to-day development.
This repository includes an Agent Skill in skills/slic/ that teaches AI coding assistants (Claude Code, Cursor, Copilot, Gemini CLI, and 30+ other tools) how to create and run WordPress integration tests with slic.
The skill gives agents structured context about:
- The slic CLI workflow (
here,use,init,run,shell) - WPUnit test structure, naming conventions, and namespaces
setUp()/tearDown()environment tiers (minimal, standard, full isolation)- HTTP mocking patterns for WordPress (
pre_http_requestfilter) - Assertion helpers and WordPress test factories
- Advanced patterns (REST API dispatch, Reflection, custom tables)
- An 11-item test isolation checklist for preventing flaky tests
Agent Skills-compatible tools discover the skill automatically when working inside this repository or any project that references it. The entry point is skills/slic/SKILL.md, which links to detailed sub-documents that agents load on demand.
For manual installation in other projects, use the skills CLI:
# Install globally (available to all projects):
npx skills add stellarwp/slic -g
# Install for a specific project:
npx skills add stellarwp/slic
# Install for a specific agent:
npx skills add stellarwp/slic --agent cursor
# List available skills before installing:
npx skills add stellarwp/slic --listThis guide covers the steps needed when upgrading slic between major versions.
New Feature:
- Multi-stack support allows running multiple isolated slic environments simultaneously
- Automatic port assignment eliminates port configuration and conflicts
Stop the 2.x containers first, with 2.x still installed:
slic stop
slic upgrade3.0 names each stack's Docker Compose project after the stack, so it does not stop containers that 2.x started.
If you're upgrading from a single-stack setup, slic will automatically migrate your configuration:
- Your existing
.env.slic.runis backed up to.env.slic.run.backup - A new stack is registered for your current configuration, with its target and settings
- WordPress, MySQL and Redis ports are no longer fixed: Docker assigns them when the stack starts, and
slic usingorslic stack infoshows them - You can continue working exactly as before
No other action required – the migration happens automatically on your next slic command.
After migration, you can:
-
Create additional stacks for other projects:
cd /path/to/another/project/wp-content/plugins slic here -
View all your stacks:
slic stack list
-
Check current ports (now auto-assigned by Docker):
slic using
-
Target specific stacks when needed:
slic --stack=/path/to/project run wpunit
See Working with Multiple Stacks for complete documentation.
Breaking Change:
- MySQL 5.5.62 is now used with PHP 7.4 to match WordPress minimum requirements
- You can opt out of this by setting the
SLIC_DB_NO_MINenv var to a non-falsy value - You can specify the database image to use with the
SLIC_DB_IMAGEenv var - Database dump collations might need to be updated in test files
What you need to update:
If your tests use database dumps, they might need updating to be compatible with MySQL 5.5.62.
The change needed is updating the collation of database tables from utf8mb4_unicode_520_ci to utf8mb4_unicode_ci.
Option 1: Use this command:
find ./tests -type f -name "*.sql" | xargs -I{} sed -i.bak 's/utf8mb4_unicode_520_ci/utf8mb4_unicode_ci/g' {} && find ./tests -name "*.sql.bak" -deleteOption 2: Use your IDE's search-and-replace functionality to replace, in the database dump files, occurrences of utf8mb4_unicode_520_ci with utf8mb4_unicode_ci.
Verifying the changes: After updating your SQL files, run a sample test to ensure the database loads correctly. Look for any SQL errors related to collations in your test output.
Props to @lucatume, @borkweb, and The Events Calendar team for creating this tool and it's predecessor, tric.




