Thank you for considering contributing to Tempcord! We welcome contributions from everyone and are grateful for every contribution, no matter how small.
- Code of Conduct
- Getting Started
- How to Contribute
- Development Setup
- Coding Standards
- Testing
- Pull Request Process
- Reporting Issues
- Feature Requests
This project and everyone participating in it is governed by our Code of Conduct. By participating, you are expected to uphold this code.
- PHP 8.2 or higher
- Composer
- Git
- A Discord application and bot token for testing
-
Fork the repository
# Click the "Fork" button on GitHub, then clone your fork git clone https://github.com/your-username/tempcord.git cd tempcord
-
Install dependencies
composer install
-
Set up environment
cp .env.example .env # Edit .env with your Discord bot credentials -
Run tests to ensure everything works
composer test
We welcome several types of contributions:
- Bug fixes: Help us squash bugs!
- Feature development: Add new functionality
- Documentation: Improve our docs
- Testing: Add or improve tests
- Code quality: Refactoring, performance improvements
- Examples: Add usage examples or tutorials
- Check existing issues: Look for existing issues or discussions about your idea
- Create an issue: For significant changes, create an issue first to discuss the approach
- Small changes: For small bug fixes or improvements, you can directly create a PR
Use descriptive branch names:
feature/add-slash-commandsbugfix/fix-memory-leakdocs/update-installation-guiderefactor/improve-event-handling
Follow conventional commit format:
type(scope): description
[optional body]
[optional footer]
Types:
feat: New featurefix: Bug fixdocs: Documentation changesstyle: Code style changes (formatting, etc.)refactor: Code refactoringtest: Adding or updating testschore: Maintenance tasks
Examples:
feat(commands): add support for slash command options
fix(events): resolve memory leak in event listener
docs(readme): update installation instructions
- Follow PSR-12 coding standard
- Use strict types:
declare(strict_types=1); - Add type hints for all parameters and return types
- Use meaningful variable and method names
- Write self-documenting code with clear comments when necessary
We use PHP CS Fixer to maintain consistent code style:
# Check code style
composer format:check
# Fix code style issues
composer formatWe use PHPStan and Psalm for static analysis:
# Run PHPStan
composer analyse
# Run Psalm
composer psalm- Write tests for all new functionality
- Maintain or improve test coverage
- Use descriptive test method names
- Follow the AAA pattern (Arrange, Act, Assert)
<?php
namespace Tests\Unit;
use PHPUnit\Framework\TestCase;
use Tempcord\YourClass;
class YourClassTest extends TestCase
{
public function test_it_does_something_expected(): void
{
// Arrange
$instance = new YourClass();
// Act
$result = $instance->doSomething();
// Assert
$this->assertEquals('expected', $result);
}
}# Run all tests
composer test
# Run tests with coverage
composer test:coverage
# Run specific test file
vendor/bin/phpunit tests/Unit/YourClassTest.php
# Run tests matching a pattern
vendor/bin/phpunit --filter="test_it_does_something"-
Update your branch
git checkout main git pull upstream main git checkout your-feature-branch git rebase main
-
Run the full test suite
composer test composer analyse composer format:check -
Update documentation if needed
- Clear title and description: Explain what your PR does and why
- Link related issues: Use "Fixes #123" or "Closes #123"
- Small, focused changes: Keep PRs focused on a single concern
- Add tests: Include tests for new functionality
- Update docs: Update relevant documentation
## Description
Brief description of changes
## Type of Change
- [ ] Bug fix
- [ ] New feature
- [ ] Breaking change
- [ ] Documentation update
## Testing
- [ ] Tests pass locally
- [ ] Added tests for new functionality
- [ ] Manual testing completed
## Checklist
- [ ] Code follows project style guidelines
- [ ] Self-review completed
- [ ] Documentation updated
- [ ] No breaking changes (or clearly documented)When reporting bugs, please include:
- Clear title: Summarize the issue
- Environment details: PHP version, OS, Tempcord version
- Steps to reproduce: Detailed steps to reproduce the issue
- Expected behavior: What should happen
- Actual behavior: What actually happens
- Code samples: Minimal code to reproduce the issue
- Error messages: Full error messages and stack traces
**Environment:**
- PHP Version: 8.2.x
- Tempcord Version: x.x.x
- OS: macOS/Linux/Windows
**Description:**
A clear description of the bug.
**Steps to Reproduce:**
1. Step one
2. Step two
3. Step three
**Expected Behavior:**
What should happen
**Actual Behavior:**
What actually happens
**Code Sample:**
```php
// Minimal code to reproduceError Messages:
Full error message and stack trace
For feature requests, please:
- Check existing issues: Ensure the feature hasn't been requested
- Describe the problem: What problem does this solve?
- Propose a solution: How should it work?
- Consider alternatives: What other approaches could work?
- Provide examples: Show how it would be used
- Use clear, concise language
- Include code examples
- Test all code examples
- Follow existing documentation style
- Update table of contents if needed
docs/
├── getting-started.md
├── commands.md
├── events.md
├── middleware.md
├── configuration.md
└── api-reference.md
- GitHub Discussions: For questions and general discussion
- Issues: For bug reports and feature requests
- Discord: Join our community Discord server
We recognize contributors in several ways:
- Contributors list in README
- Release notes mention significant contributions
- Special recognition for major contributions
We follow Semantic Versioning:
- MAJOR: Breaking changes
- MINOR: New features (backward compatible)
- PATCH: Bug fixes (backward compatible)
- Update CHANGELOG.md
- Update version in composer.json
- Create release tag
- Update documentation
- Announce release
If you have questions about contributing, please:
- Check this document first
- Search existing issues and discussions
- Create a new discussion or issue
- Reach out on Discord
Thank you for contributing to Tempcord! 🎉