Thank you for your interest in contributing to Multisite Ultimate! This document provides guidelines and information for developers.
- PHP 7.4+ (8.1+ recommended for development)
- Node.js 16+ and npm
- Composer
- Git
- WordPress Multisite environment
-
Clone and setup the repository:
git clone https://github.com/superdav42/wp-multisite-waas.git cd wp-multisite-waas npm run dev:setup -
Or setup manually:
npm run install:deps # Installs both composer and npm dependencies npm run setup:hooks # Sets up Git hooks
npm test # Run PHPUnit tests
npm run test:coverage # Run tests with coverage
npm run lint # Check code style (PHPCS)
npm run lint:fix # Fix code style automatically (PHPCBF)
npm run stan # Run static analysis (PHPStan)
npm run quality # Run lint + stan
npm run quality:fix # Run lint:fix + stan
npm run check # Run all checks before committing
npm run build # Production build
npm run build:dev # Development build
npm run clean # Clean build artifacts
npm run dev:setup # Complete development setupcomposer test # Run PHPUnit tests
composer test:coverage # Run tests with coverage
composer lint # Run PHPCS
composer lint:fix # Run PHPCBF to fix issues
composer stan # Run PHPStan
composer quality # Run lint + stan
composer setup-hooks # Setup Git hooksvendor/bin/phpunit # Run tests
vendor/bin/phpcs # Check code style
vendor/bin/phpcbf # Fix code style
vendor/bin/phpstan analyse # Static analysisWe maintain high code quality through automated tools and Git hooks:
The project includes Git hooks that run automatically:
- pre-commit: Runs PHPCS and PHPStan on changed files
- commit-msg: Enforces conventional commit format
To install hooks: npm run setup:hooks
We follow WordPress coding standards:
- PHPCS: WordPress coding standards for PHP
- PHPStan: Static analysis for type safety
- Conventional Commits: Standardized commit messages
- PHPUnit: Unit and integration tests
- Code Coverage: Aim for >80% coverage
- WordPress Test Suite: Tests run against WordPress multisite
We use Conventional Commits format:
<type>(<scope>): <description>
[optional body]
[optional footer(s)]
Types:
feat: New featuresfix: Bug fixesdocs: Documentation changesstyle: Code style changes (formatting, etc.)refactor: Code refactoringtest: Test-related changeschore: Build, dependencies, or maintenanceperf: Performance improvementsci: CI/CD changesbuild: Build system changesrevert: Revert previous changes
Examples:
feat(checkout): add support for discount codes
fix(gateway): resolve Stripe webhook validation
docs(readme): update installation instructions
test(models): add Customer model tests- Fork the repository and create a feature branch
- Make your changes following our coding standards
- Write/update tests for your changes
- Run quality checks:
make check - Update documentation if needed
- Submit a pull request with:
- Clear description of changes
- Reference to related issues
- Screenshots for UI changes
# Run all tests
npm test
# Run with coverage
npm run test:coverage
# Run specific test
vendor/bin/phpunit tests/WP_Ultimo/Models/Customer_Test.php- Place tests in
tests/directory - Follow existing test structure
- Include unit and integration tests
- Test both success and failure scenarios
Tests run against WordPress test suite with multisite enabled:
- Uses WP_TESTS_MULTISITE=1
- Separate test database
- Isolated from production data
We aim for high code coverage:
- Target: >80% line coverage
- Reports: Generated in
coverage-html/ - CI Integration: Automatic upload to Codecov
View coverage locally:
npm run test:coverage
open coverage-html/index.html- Create feature branch:
git checkout -b feat/feature-name - Make changes with tests
- Run checks:
npm run check - Commit: Use conventional format
- Push and create PR
- Create fix branch:
git checkout -b fix/issue-description - Write test that reproduces the bug
- Fix the issue
- Verify test passes
- Run checks:
npm run check - Commit and create PR
Ultimate Multisite has 28+ addon plugins in the Ultimate-Multisite GitHub org. Each addon is a separate repo with its own release cycle, but all depend on the core plugin and share a common test infrastructure.
~/Git/
├── ultimate-multisite/ # Core plugin (canonical repo)
│ ├── addons.json # Addon manifest (all slugs + active status)
│ ├── bin/clone-addons.sh # Clone all addons
│ ├── bin/generate-wp-env-override.sh # Generate wp-env config for addons
│ └── .github/workflows/
│ └── addon-integration-test.yml # Reusable CI workflow for addons
├── ultimate-multisite-addons/ # All addon clones (created by clone-addons.sh)
│ ├── multisite-ultimate-domain-seller/
│ ├── ultimate-multisite-woocommerce/
│ └── ...
-
Clone addons (first time only):
cd ~/Git/ultimate-multisite bin/clone-addons.sh --active-only
-
Create a worktree in the addon repo:
cd ~/Git/ultimate-multisite-addons/<addon-slug> git worktree add -b feature/my-change ../../<addon-slug>-feature-my-change main cd ~/Git/<addon-slug>-feature-my-change
-
Generate wp-env override to include your addon:
cd ~/Git/ultimate-multisite bin/generate-wp-env-override.sh --addon <addon-slug>
-
Start the test environment:
cd ~/Git/ultimate-multisite npm run env:start # WordPress Multisite is now running at http://localhost:8888 # with core + your addon loaded
-
Make changes in your addon worktree, then verify:
# Run addon's PHPUnit tests cd ~/Git/<addon-slug>-feature-my-change composer install && vendor/bin/phpunit # Run static analysis vendor/bin/phpstan analyse # Browse the running site to verify visually # http://localhost:8888/wp-admin/network/
-
Run E2E tests (if the addon has them):
cd ~/Git/ultimate-multisite npx cypress run --config-file cypress.config.test.js \ --spec "../<addon-slug>-feature-my-change/tests/e2e/**/*.spec.js"
-
Commit, push, and create PR on the addon repo.
-
Stop the environment:
cd ~/Git/ultimate-multisite npm run env:stop
Every addon has a .github/workflows/ci.yml that calls the core's reusable workflow:
jobs:
integration-test:
uses: Ultimate-Multisite/ultimate-multisite/.github/workflows/addon-integration-test.yml@main
with:
addon-slug: <addon-slug>
secrets: inheritThis automatically:
- Checks out the core plugin and the addon
- Sets up a WordPress Multisite with MariaDB
- Symlinks both plugins into the WP test environment
- Runs the addon's PHPUnit tests
To enable E2E tests, add run-e2e: true to the workflow inputs.
- Use the template:
gh repo create Ultimate-Multisite/<slug> --template Ultimate-Multisite/ultimate-multisite-addon-template --private - Replace all
{{PLACEHOLDER}}values in the template files - Add the addon to
addons.jsonin the core repo - Register it in
~/.config/aidevops/repos.json
ultimate-multisite/
├── .github/workflows/ # GitHub Actions (including addon-integration-test.yml)
├── .githooks/ # Custom Git hooks
├── addons.json # Addon manifest
├── bin/ # Development scripts (including clone-addons.sh)
├── inc/ # Core PHP classes
├── tests/ # PHPUnit + E2E tests
├── assets/ # CSS/JS/images
├── views/ # Template files
├── vendor/ # Composer dependencies
├── node_modules/ # NPM dependencies
└── composer.json # PHP dependencies
Releases are automated via GitHub Actions:
- Update version numbers in plugin files
- Update CHANGELOG
- Create and push version tag:
git tag v2.x.x && git push origin v2.x.x - GitHub Action builds and creates release
- Documentation: Check existing docs and code comments
- Issues: Search existing issues before creating new ones
- Discussions: Use GitHub Discussions for questions
- Code Review: PRs get reviewed by maintainers
- Database: Use proper indexing and efficient queries
- Caching: Implement appropriate caching strategies
- Assets: Minimize and optimize CSS/JS
- Hooks: Use appropriate priority and avoid heavy operations
- Input Sanitization: Always sanitize user input
- Output Escaping: Escape output based on context
- Nonces: Use WordPress nonces for forms
- Capabilities: Check user permissions
- SQL: Use prepared statements
Enable WordPress debugging:
define('WP_DEBUG', true);
define('WP_DEBUG_LOG', true);
define('WP_DEBUG_DISPLAY', false);Use the built-in logger:
wu_log_add('debug', 'Debug message', $context);The project includes hook profiling capabilities for performance analysis.
- Extend
Base_Model - Implement CRUD operations
- Use BerlinDB for database layer
- Extend base admin page classes
- Follow WordPress admin UI patterns
- Include proper capability checks
- Modular signup fields
- Payment gateway integration
- Customizable checkout flows
- Flexible limitation system
- Plugin/theme restrictions
- Resource limits (disk, users, etc.)
Thank you for contributing to Multisite Ultimate! 🚀