Thank you for considering contributing to Free Gift Coupons Bulk Coupon Generator! This document provides guidelines and instructions for contributors.
This project follows the WordPress Community Code of Conduct. By participating, you're expected to uphold this code.
- PHP: 8.2 or higher
- WordPress: 6.8 or higher
- WooCommerce: Required for plugin functionality
- Free Gift Coupons for WooCommerce: Required for end-to-end free gift coupon behavior
- Composer: For dependency management
- Node.js: 16+ (if working with build tools)
- Git: For version control
-
Fork the repository on GitHub
-
Clone your fork locally:
git clone https://github.com/YOUR-USERNAME/free-gift-coupons-bulk-coupons-generator.git cd free-gift-coupons-bulk-coupons-generator -
Install dependencies:
composer install
-
Create a feature branch:
git checkout -b feature/your-feature-name
This project adheres to WordPress Coding Standards:
- PHP: WordPress PHP Coding Standards
- JavaScript: WordPress JavaScript Coding Standards
- CSS: WordPress CSS Coding Standards
- HTML: WordPress HTML Coding Standards
-
Security First: All code must follow OWASP security guidelines
- Input validation and sanitization
- Output escaping with context-appropriate functions
- CSRF protection with nonces
- Capability checks for admin functions
-
Performance: Optimize for efficiency
- Use WordPress caching mechanisms
- Minimize database queries
- Conditional loading of assets
-
Internationalization: All user-facing strings must be translatable
- Use
__(),_e(),esc_html__(),esc_html_e()functions - Text domain:
free-gift-bulk-coupon-generator
- Use
-
Accessibility: Follow WCAG guidelines
- Proper semantic markup
- Keyboard navigation support
- Screen reader compatibility
Run coding standards checks:
composer run phpcsRun static analysis:
composer run phpstanRun tests (when available):
composer testfree-gift-bulk-coupon-generator/
|-- free-gift-bulk-coupon-generator.php # Main plugin file
|-- includes/ # Plugin source files
|-- assets/ # Admin CSS and JavaScript
|-- README.md # Project documentation
|-- readme.txt # WordPress.org readme
|-- CHANGELOG.md # Version history
|-- CONTRIBUTING.md # This file
|-- LICENSE # GPL license
|-- composer.json # PHP dependencies
|-- phpcs.xml # PHPCS configuration
|-- phpstan.neon # PHPStan configuration
|-- phpmd.xml # PHPMD configuration
|-- languages/ # Translation files
| `-- free-gift-bulk-coupon-generator.pot
`-- .github/ # GitHub workflows
`-- workflows/
- Check existing issues and pull requests
- Create an issue for significant changes to discuss the approach
- Follow the existing code patterns and conventions
- Input Validation: Validate all user inputs
- Output Escaping: Use
esc_html(),esc_attr(),esc_url()as appropriate - Sanitization: Use
sanitize_text_field(),sanitize_textarea_field(), etc. - Nonce Verification: Protect forms with WordPress nonces
- Capability Checks: Verify user permissions with
current_user_can()
- PHPDoc: All functions must have PHPDoc comments
- @since: Include version tags for new functions
- Inline Comments: Explain complex logic
- Security Notes: Document security measures taken
/**
* Example function with proper documentation
*
* @since 1.5.13
* @param string $input User input to process.
* @return string Sanitized output.
*/
function fgcbg_example_function( $input ) {
// Security: Validate and sanitize input.
if ( ! current_user_can( 'manage_options' ) ) {
return '';
}
$sanitized = sanitize_text_field( $input );
// Additional processing.
return esc_html( $sanitized );
}-
Manual Testing:
- Test in WordPress 6.8+ and the latest version
- Test with PHP 8.2 and 8.3+ for development tooling
- Verify admin interface functionality
- Verify WooCommerce coupon creation and Free Gift Coupons metadata
-
Automated Testing:
- Run PHPCS for coding standards
- Run PHPStan for static analysis
- Ensure CI/CD tests pass
- Batch Generation: Keep coupon creation server-friendly and bounded
- Conditional Loading: Only load admin assets on the generator screen
- Database Queries: Minimize WooCommerce product and coupon lookups
- Hook Priority: Use appropriate hook priorities
-
Create Feature Branch:
git checkout -b feature/description-of-change
-
Make Changes:
- Follow coding standards
- Add/update tests if applicable
- Update documentation
-
Test Changes:
composer run phpcs composer run phpstan
-
Commit Changes:
git add . git commit -m "feat: add coupon generation option"
-
Push and Create PR:
git push origin feature/description-of-change
Use Conventional Commits:
feat:New featuresfix:Bug fixesdocs:Documentation changesstyle:Code style changesrefactor:Code refactoringtest:Test additions/changeschore:Maintenance tasks
Examples:
feat: add coupon prefix validation
fix: preserve free gift coupon metadata
docs: update installation instructions
style: fix PHPCS formatting violations
- Code follows WordPress coding standards
- All functions have proper PHPDoc documentation
- Security best practices implemented
- PHPCS and PHPStan checks pass
- Manual testing completed
- Documentation updated if needed
- CHANGELOG.md updated
When releasing new versions, update these files:
free-gift-bulk-coupon-generator.php(plugin header)README.mdreadme.txtCHANGELOG.mdlanguages/free-gift-bulk-coupon-generator.pot
This project follows Semantic Versioning:
- MAJOR: Breaking changes
- MINOR: New features (backward compatible)
- PATCH: Bug fixes (backward compatible)
- Issues: GitHub Issues
- Discussions: GitHub Discussions
- Security: Email security@enginescript.com for security issues
By contributing to Free Gift Coupons Bulk Coupon Generator, you agree that your contributions will be licensed under the GPL-3.0-or-later license.
Thank you for contributing to Free Gift Coupons Bulk Coupon Generator!