{"id":46295312,"url":"https://github.com/stellarwp/slic","last_synced_at":"2026-03-04T09:31:06.131Z","repository":{"id":41905446,"uuid":"266120330","full_name":"stellarwp/slic","owner":"stellarwp","description":"The slic (StellarWP Local Interactive Containers) CLI command provides a containerized and consistent environment for running automated tests.","archived":false,"fork":false,"pushed_at":"2026-02-23T15:26:33.000Z","size":5336,"stargazers_count":40,"open_issues_count":18,"forks_count":5,"subscribers_count":43,"default_branch":"main","last_synced_at":"2026-02-23T22:27:10.153Z","etag":null,"topics":["codeception","docker","hacktoberfest"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/stellarwp.png","metadata":{"files":{"readme":"README.md","changelog":"changelog.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2020-05-22T13:42:10.000Z","updated_at":"2026-02-03T16:00:48.000Z","dependencies_parsed_at":"2023-11-20T18:29:45.894Z","dependency_job_id":"08b8fb5c-f945-445f-ba81-2bafd788b5fc","html_url":"https://github.com/stellarwp/slic","commit_stats":null,"previous_names":[],"tags_count":92,"template":false,"template_full_name":null,"purl":"pkg:github/stellarwp/slic","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stellarwp%2Fslic","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stellarwp%2Fslic/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stellarwp%2Fslic/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stellarwp%2Fslic/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/stellarwp","download_url":"https://codeload.github.com/stellarwp/slic/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stellarwp%2Fslic/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30077064,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-04T08:01:56.766Z","status":"ssl_error","status_checked_at":"2026-03-04T08:00:42.919Z","response_time":59,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["codeception","docker","hacktoberfest"],"created_at":"2026-03-04T09:31:04.806Z","updated_at":"2026-03-04T09:31:06.069Z","avatar_url":"https://github.com/stellarwp.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# slic\n\nThe slic (**S**tellarWP **L**ocal **I**nteractive **C**ontainers) CLI command provides a containerized and consistent environment for running automated tests.\n\n## Table of Contents\n\n* [Getting started](#getting-started)\n    * [Why use `slic`?](#why-use-slic)\n    * [Why use Codeception?](#why-use-codeception)\n    * [Requirements](#requirements)\n    * [Installation](#installation)\n    * [The most important command to know](#the-most-important-command-to-know)\n* [Using `slic`](#using-slic)\n    * [Tell `slic` how to find your project](#tell-slic-how-to-find-your-project)\n    * [Preparing your project](#preparing-your-project)\n    * [Adding tests](#adding-tests)\n    * [Running tests](#running-tests)\n* [Advanced topics](#advanced-topics)\n    * [Defaults for your project with `slic.json`](/docs/slicjson.md)\n    * [Managing PHP Versions](#managing-php-versions)\n    * [Making composer installs faster](#making-composer-installs-faster)\n    * [Changing your composer version](#changing-your-composer-version)\n    * [Customizing `slic`'s `.env` file](#customizing-slics-env-file)\n    * [Xdebug and `slic`](#xdebug-and-slic)\n    * [Configuring IDEs for Xdebug](/docs/xdebug.md)\n    * [Releasing a new version of `slic`](/CONTRIBUTING.md)\n* [Update guide](#update-guide)\n  * [From 1.0 to 2.0](#from-10-to-20)\n\n\n## Getting started\n\n### Why use `slic`?\n\nOne 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.\n\n**`slic` automatically configures a Codeception testing environment so you don't have to.**\n\nPlus, it provides a lot of handy development tools and utilities that you can use while developing your project _or_ during Continuous Integration builds!\n\n### Why use Codeception?\n\n[Codeception](https://codeception.com/) is a PHP testing framework that uses [PHPUnit](https://phpunit.de/) 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](https://wpbrowser.wptestkit.dev/), a module that _greatly_ simplifies testing WordPress plugins, themes, and whole WP sites at all levels of testing.\n\n» Learn more about [wp-browser here](https://wpbrowser.wptestkit.dev/) and get it set up on your project.\n\n\u003e You can see examples of what to toss in your `composer.json` in our [stellarwp/schema](https://github.com/stellarwp/schema/blob/main/composer.json) repository.\n\n### Requirements\n\nDocker.\n\nThat's the only prerequisite. Get that installed and running on your machine and you'll be good to go!\n\n### Installation\n\n#### 1. Clone the repo\n\n\u003e These instructions are assuming that you are cloning the `slic` repository in `~/projects`. If you want it in a different location, feel free to tweak the example commands below.\n\n```bash\ncd ~/projects\ngit clone git@github.com:stellarwp/slic.git\n```\n\n#### 2. Add `slic` to your `$PATH`\n\n_Assuming you are cloning the `slic` repository in `~/projects`:_\n\n```bash\necho \"export PATH=$HOME/projects/slic:$PATH\" \u003e\u003e ~/.bashrc\nsource ~/.bashrc\n```\n\n\u003e If you are using zsh, change `~/.bashrc` to `~/.zshrc`.\n\n### The most important command to know\n\n`slic` is well documented within the CLI utility itself. To see all of the available commands, run:\n\n```bash\nslic help\n```\n\nYou can see details and usage on each command by running:\n\n```bash\nslic help \u003ccommand\u003e\n```\n\n## Using `slic`\n\nThe `slic` command has many subcommands. You can discover what those are by typing `slic` or `slic help`. If you want\nmore details on any of the subcommands, simply type: `slic [subcommand] help`.\n\n### Tell `slic` how to find your project\n\nThe `slic` command needs a place to look for plugins, themes, and WordPress. By default, `slic` creates a `_plugins` and\n`_wordpress` directory within the local checkout of `slic`. In most cases, however, developers like to run automated tests\nagainst the paths where they are actively working on code – which likely lives elsewhere.\n\nGood news! You can use the `slic here` sub-command to re-point `slic`'s paths so it looks in the places you wish. There\nare two locations you can tell `slic` to look.\n\n#### 1. Plugins Directory\n\nIf you want to defer all of the WP site configuration to a dynamically pulled codebase and _just_ worry about testing\nplugins, 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.\n\nExample:\n\n```bash\n# Change to your plugin containing dir (likely some path to wp-content/plugins)\ncd /path/to/your/wp-content/plugins\n\nslic here\n```\n\n![slic here](docs/images/slic-here.gif)\n\n#### 2. WordPress Directory\n\nThe second option is to navigate to the root of your site (likely where `wp-config.php` lives) and run the `slic here`\ncommand.\n\n\u003e Note: This is an opinionated option and there are some assumptions that are made:\n\u003e\n\u003e 1. That the WordPress directory _is_ the path you are indicating or in a sub-directory called `wp/`.\n\u003e 2. That the `wp-content/` (or `content/`) directory is a sub-directory of the location in which you are typing `slic here`.\n\n\n```bash\n# Change to your root directory of your site (where your wp-config.php file lives)\ncd /path/to/your/site\n\nslic here\n```\n\nBy running `slic here` at the site level, this allows you to set plugins, themes, or the site itself as the location\nfrom which to run tests. This also has the benefit of running tests within the WP version that your site uses.\n\n![slic here](docs/images/slic-here-wp.gif)\n\n### Preparing your project\n\n### Point `slic` at your project\n\nBefore you can do anything productive with `slic`, you need to tell it which\nproject you wish to use and then you can initialize the project, run tests, and\nexecute other commands to your heart's content!\n\nAssuming you have a plugin called `the-events-calendar` in the plugins directory\nwhere you ran `slic here`, you can tell `slic` you want to take actions on that\nplugin using the following command:\n\n```bash\nslic use the-events-calendar\n```\n\n\u003e For more information on this command, run `slic help use`.\n\n![slic use](docs/images/slic-use.gif)\n\n### Initialize your project\n\nWith your desired plugin containing directory set, you will need to initialize plugins so that they are prepped and ready\nfor `slic`-based automated test running. You do that using `slic init [plugin]`.\n\nExample:\n\n```bash\nslic init event-tickets\n```\n\n![slic init](docs/images/slic-init.gif)\n\nWhat this command does:\n\n1. Generates a `.env.testing.slic` env file in the plugin.\n2. Generates a `test-config.slic.php` file in the plugin.\n3. Generates a `codeception.slic.yml` file in the plugin.\n4. Prompts for confirmation on running `composer` and `npm` installs on the plugin.\n\n### Adding tests\n\nAs mentioned above, you'll need to use Codeception for your automated testing and it is _highly_ recommended that you make use of [wp-browser](https://wpbrowser.wptestkit.dev/) - which adds a _lot_ of WordPress helper functions and utilities.\n\n### Running tests\n\nOk. 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`.\n\nYou can run the full suite like so:\n\n```bash\nslic run wpunit\n```\n\nOr, if you want an even more efficient way to do it, you can do:\n\n```bash\nslic shell\n\n# You'll get a prompt once you are thrown into the shell\n\n\u003e cr wpunit\n```\n\n## Advanced topics\n\n### Managing PHP Versions\n\nBy default, slic uses PHP 7.4, but you can easily switch between different PHP versions for your projects.\n\n#### Checking the Current PHP Version\n\nTo see which PHP version slic is configured to use or if a version is staged:\n\n```bash\nslic php-version\n```\n\n#### Setting a PHP Version\n\nIf you're working with a project and want to test it with a different PHP version, you can manually set the version:\n\n```bash\nslic php-version set 8.1\n```\n\nThis 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.\n\nFor CI environments or when you want to pre-configure the PHP version before running `slic use`:\n\n```bash\nslic php-version set 8.4 --skip-rebuild\n```\n\nThis stages the PHP version change for the next time you run `slic use \u003cproject\u003e`, allowing you to avoid pulling Docker images multiple times.\n\n#### Automatic PHP Version Detection\n\nWhen you run `slic use \u003cproject\u003e`, slic will automatically detect and use the PHP version specified in:\n\n1. The project's `slic.json` file (using the `phpVersion` property)\n2. The project's `composer.json` file (using the `config.platform.php` property)\n\n#### PHP Version Priority\n\nPHP versions are applied in the following priority order:\n\n1. Command line override: `SLIC_PHP_VERSION=8.3 slic use \u003cproject\u003e`\n2. Staged version (from `slic php-version set \u003cversion\u003e --skip-rebuild`)\n3. A Project's `.env.slic.local` file\n4. Auto-detected version from project configuration\n\n#### Resetting to Default\n\nTo reset slic to the default PHP version (7.4):\n\n```bash\nslic php-version reset\n```\n\n### Making composer installs faster\n\nBy default, `slic` caches composer dependencies within the container\nand, when the containers are destroyed, so is the cache. The good news\nis that `slic` allows you to map your machine's composer cache directory into\nthe `slic` containers so that repeated `slic composer` commands can benefit from\nthe cache as well!\n\n```bash\n# Feel free to change the path to whatever is appropriate for your machine.\nslic composer-cache set $HOME/.cache/composer\n```\n\nFor more information on this topic, type `slic help composer-cache`.\n\n![slic composer-cache](docs/images/slic-composer-cache.gif)\n\n### Changing your composer version\n\nBy default, `slic` uses composer v1 but you may also choose to use v2 by running the following command:\n\n`slic composer set-version 2`\n\nIf you need to go back, just set the version back to 1:\n\n`slic composer set-version 1`\n\nIf you want to know which version `slic` is pointed at, you can always call:\n\n`slic composer get-version`\n\n### Installing private packages with composer\n\nIf you need to install a private composer package, configure the [COMPOSER_AUTH](https://getcomposer.org/doc/03-cli.md#composer-auth) environment variable. For example, to install a package from a private GitHub repository:\n\n\u003e Note: You may need to create a [Personal Access Token](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token).\n\n```shell\nexport COMPOSER_AUTH='{\"github-oauth\": {\"github.com\": \"YOUR_TOKEN_HERE\"}}'\n```\n\nThen, restart slic and try again:\n\n```shell\nslic restart; slic composer update\n```\n\nOr, in a GitHub Action, for example:\n\n```yaml\njobs:\n  test:\n    runs-on: ubuntu-latest\n\n    env:\n      COMPOSER_AUTH: '{\"github-oauth\": {\"github.com\": \"${{ secrets.GH_BOT_TOKEN }}\"}}'\n```\n\n### Customizing `slic`'s `.env` file\n\nThe `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:\n\n1. [`.env.slic`](/.env.slic) - this is the default `.env` file and **should not be edited**.\n2. `.env.slic.local` in 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.\n3. `.env.slic.local` in your _target's_ directory - this file doesn't exist by default. Make overrides to a single project (e.g. `SLIC_PHP_VERSION`).\n4. `.env.slic.run` - this file is generated by `slic` and includes settings that are set by specific `slic` commands.\n\n### Xdebug and `slic`\n\n#### Available Commands\n\n##### `slic xdebug help`\n\nList the available Xdebug commands.\n\n##### `slic xdebug status`\n\nSee if Xdebug is enabled or disabled, the host information, and the path mapping to add to your IDE.\n\nNote that this command cannot be ran within `slic shell` because you've SSH'd into the Codeception container which has no knowledge of *slic*.\n\nSee also: [Configuring Xdebug](/docs/xdebug.md)\n\n\n#### Enable/Disable Xdebug\n\nXdebug can be toggled in both the `wordpress` and `slic` containers:\n\n**Global commands** (requires container restart):\n- `slic xdebug on` - Enable Xdebug in both containers\n- `slic xdebug off` - Disable Xdebug in both containers\n\nWhen using these commands, `slic` will prompt you to restart the containers.\n\n**Within `slic shell`** (takes effect immediately, no restart needed):\n- `xon` - Enable Xdebug\n- `xoff` - Disable Xdebug\n\n## Update Guide\n\nThis guide covers the steps needed when upgrading `slic` between major versions.\n\n### From 1.0 to 2.0\n\n\u003e **Breaking Change:**\n\u003e - MySQL 5.5.62 is now used with PHP 7.4 to match WordPress minimum requirements\n\n#### MySQL 5.5 Database Changes\n\n* You can opt out of this by setting the `SLIC_DB_NO_MIN` env var to a non-falsy value\n* You can specify the database image to use with the `SLIC_DB_IMAGE` env var\n* Database dump collations might need to be updated in test files\n\n**What you need to update:**\n\nIf your tests use database dumps, they might need updating to be compatible with MySQL `5.5.62`.  \nThe change needed is updating the collation of database tables from `utf8mb4_unicode_520_ci` to `utf8mb4_unicode_ci`.\n\n**Option 1:** Use this command:\n\n```bash\nfind ./tests -type f -name \"*.sql\" | xargs -I{} sed -i.bak 's/utf8mb4_unicode_520_ci/utf8mb4_unicode_ci/g' {} \u0026\u0026 find ./tests -name \"*.sql.bak\" -delete\n```\n\n**Option 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`.\n\n**Verifying the changes:**\nAfter updating your SQL files, run a sample test to ensure the database loads correctly.\nLook for any SQL errors related to collations in your test output.\n\n## Acknowledgements\n\nProps to [@lucatume](https://github.com/lucatume), [@borkweb](https://github.com/borkweb), and [The Events Calendar](https://theeventscalendar.com) team for creating this tool and it's predecessor, `tric`.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstellarwp%2Fslic","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstellarwp%2Fslic","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstellarwp%2Fslic/lists"}