Contributing
We welcome contributions to any LW plugin. All repositories are on GitHub .
How to Contribute
- Fork the repository on GitHub
- Create a feature branch:
git checkout -b feature/your-feature - Make your changes following the coding standards below
- Run
composer phpcsand fix any issues - Commit your changes with a clear message
- Push to your fork and open a Pull Request against
main
Coding Standards
| Rule | Value |
|---|---|
| PHP version | 8.2+ |
| Coding standard | WordPress Coding Standards (WPCS) |
| Autoloading | PSR-4 (strict) |
| Strict types | declare(strict_types=1); in every file |
| Namespace pattern | LightweightPlugins\{PluginName} |
| Indentation | Tabs (not spaces) |
File Size Limits
Keep files small and focused. Every class should have a single responsibility.
| File type | Max lines |
|---|---|
| Class | ~200 |
| Trait | ~80 |
| Interface | ~30 |
| Method | ~30 |
If a class exceeds 200 lines, split it into smaller classes with clear responsibilities.
Commit Checklist
Before every commit, run the linter:
# 1. Check for issues
composer phpcs
# 2. Auto-fix what can be fixed
composer phpcbf
# 3. Check again
composer phpcs
# 4. Only commit if there are zero errors
git add .
git commit -m "Add feature description"PSR-4 File Naming
File paths must mirror the namespace. Use PascalCase for directories and filenames.
| Namespace | File path |
|---|---|
LightweightPlugins\SEO\Admin\SettingsPage | includes/Admin/SettingsPage.php |
LightweightPlugins\SEO\WooCommerce\Schema | includes/WooCommerce/Schema.php |
Do not use class- prefixes, lowercase directories, or underscores in filenames.
Reporting Issues
Open an issue on the relevant plugin’s GitHub repository. Include:
- WordPress and PHP version
- Steps to reproduce
- Expected vs. actual behavior
- Any error messages or logs