-
Notifications
You must be signed in to change notification settings - Fork 209
Setting Up Your Development Environment
This page will guide you through the process of setting up Sensei LMS development environment on your local machine. It should work on Linux, macOS, or Windows Subsystem for Linux on Windows 10.
- Pre-requisites
- Quick Start
- Development Workflow
- IDE Configuration
- Troubleshooting
- Additional resources
Before starting, make sure you have the following software installed and working on your machine:
- Git to clone the Sensei LMS repository (or your fork of the Sensei LMS repository).
- Node.js (version >= 22) and NPM to install Node packages used to build assets and other tasks.
- If using nvm:
nvm install 22 && nvm use 22
-
Composer to install PHP packages required by Sensei LMS such as the
sensei-rest-apiand thejetpack-autoloader. It's also necessary to use the PHP CodeSniffer that ensures your code follows code standards. - WP-CLI for updating i18n pot files.
Clone Sensei into a local directory:
git clone https://github.com/Automattic/sensei.git
cd senseiOr clone your fork:
git clone https://github.com/YOUR-USERNAME/sensei.git
cd senseimake install
This installs all NPM dependencies required for development.
make up
This starts a Docker-based WordPress instance with Sensei installed. The site will be available at:
- URL: http://localhost:8888
- Admin username: admin
- Admin password: password
make install-php
This runs composer install inside the WordPress container to install PHP dependencies.
For development with live rebuilding:
npm run start
This watches source files and rebuilds JavaScript/CSS automatically when you make changes.
For a one-time production build:
npm run build:assets
Run make help to see all available commands:
| Command | Description |
|---|---|
| make install | Install NPM dependencies (requires Node 22+) |
| make install-php | Install PHP dependencies via composer |
| make up | Start the WordPress development environment |
| make down | Stop the WordPress environment |
| make destroy | Remove all containers and data |
| make shell | Open a bash shell in the WordPress container |
| make wp CMD="..." | Run WP-CLI commands (e.g., make wp CMD="plugin list") |
| make test-php | Run PHPUnit tests |
| make lint | Run PHP CodeSniffer |
| make build | Build a plugin zip file |
| make logs | View WordPress environment logs |
You can test Sensei with specific WordPress or PHP versions:
make up WP=6.8
make up PHP=8.3
make up WP=6.8 PHP=8.3
make up WP=nightly
make up WP=7.0-beta1
make up WP=6.9-RC1- Create a new branch: git checkout -b your-feature-branch
- Make your changes to the code
- If you modified JavaScript or SCSS files, ensure
npm run startis running - Test your changes at http://localhost:8888
- Run
npm run changelogto create a changelog entry for user-facing changes
make test-php
make lint
npm run lint:js
Consider installing the Plugin Check plugin. It helps ensure Sensei meets WordPress.org plugin repository requirements. It runs automated checks for common issues including security, performance, and coding standards violations.
make wp CMD="plugin install plugin-check --activate"
From the WordPress admin at http://localhost:8888/wp-admin, navigate to Tools → Plugin Check, select "Sensei LMS" from the dropdown, and click "Check it!".
Running these checks before submitting a pull request can catch issues early, especially if you've added new features or modified plugin metadata.
To access the WordPress container's MySQL database:
make shell
wp db cliOr use a database client with these credentials:
- Host: localhost
- Port: 3306 (mapped from container)
- Database: wordpress
- Username: root
- Password: password
Sensei uses pre-commit hooks to enforce code standards. These are installed automatically when you run npm install.
- PHP_CodeSniffer - For PHP code style checking
- ESLint - For JavaScript linting
- EditorConfig - For consistent formatting across editors
If make up fails:
- Ensure Docker is running
- Check if ports 8888 or 3306 are already in use
- Try
make destroythenmake upagain
If asset compilation fails:
- Verify Node.js version: node --version (should be 22+)
- Remove node_modules and reinstall: rm -rf node_modules && make install
- Check for errors in npm run start output
If you see PHP autoloader errors:
make install-php
Sensei LMS is an open source online course plugin built for WordPress and lovingly crafted by Automattic and the Sensei LMS community ❤