Help improve auditor-bundle
Thank you for considering contributing to auditor-bundle!
- 🐛 Report bugs - Submit issues on GitHub
- 💡 Suggest features - Open a discussion or issue
- 📖 Improve documentation - Fix typos, add examples, clarify explanations
- 🔧 Submit code - Fix bugs or implement new features
- ⭐ Star the project - Show your support
All code contributions are made via Pull Requests (PR). Direct commits to the master branch are not allowed.
- Fork the repository on GitHub
- Clone your fork locally:
git clone https://github.com/YOUR_USERNAME/auditor-bundle.git
cd auditor-bundle- Install dependencies:
composer install- Create a branch for your changes:
git checkout -b feature/my-new-feature# Run all tests
composer test
# Run tests with coverage
composer test:coverage
# Run tests with testdox output
composer testdoxThe project includes a Makefile that allows you to test against different combinations of PHP versions and Symfony versions using Docker containers. This ensures your code works across all supported environments.
Prerequisites:
- Docker
- Docker Compose
- Make
Available Make Targets:
| Target | Description |
|---|---|
tests |
Run the test suite using PHPUnit |
cs-fix |
Run PHP-CS-Fixer to fix coding standards |
phpstan |
Run PHPStan for static code analysis |
help |
Display available commands and options |
Options:
| Option | Values | Default | Description |
|---|---|---|---|
php |
8.4, 8.5 |
8.5 |
PHP version |
sf |
8.0 |
8.0 |
Symfony version |
args |
Any PHPUnit/tool arguments | (varies) | Additional arguments |
Valid PHP/Symfony Combinations:
| PHP Version | Symfony Versions |
|---|---|
| 8.4 | 8.0 |
| 8.5 | 8.0 |
Examples:
# Show all available commands and options
make help
# Run tests with defaults (PHP 8.5, Symfony 8.0)
make tests
# Run tests with specific PHP version
make tests php=8.4
# Run specific test class
make tests args='--filter=ViewerControllerTest'
# Run tests with coverage
make tests args='--coverage-html=coverage'Testing Multiple Versions:
Tip
Before submitting a pull request, it's recommended to test against multiple PHP versions:
# Test different PHP versions
make tests php=8.4
make tests php=8.5Before submitting, ensure your code passes all quality checks.
# Run all QA tools
composer qa
# Individual tools:
composer cs-check # Check code style
composer cs-fix # Fix code style
composer phpstan # Static analysis
composer rector # Automated refactoring suggestions# Run PHP-CS-Fixer
make cs-fix
# Run PHPStan
make phpstan
# With specific PHP version
make phpstan php=8.4
# With custom arguments
make cs-fix args='fix --dry-run'Write clear, concise commit messages:
- ✅ Use the present tense ("Add feature" not "Added feature")
- ✅ Use the imperative mood ("Move cursor to..." not "Moves cursor to...")
- ✅ Limit the first line to 72 characters
- ✅ Reference issues and pull requests when relevant
Good examples:
Add support for custom viewer templatesFix RoleChecker when no user is authenticatedUpdate documentation for v7 migration
- ✅ Ensure all tests pass (ideally on multiple PHP/Symfony combinations)
- ✅ Run code quality tools (
make cs-fix,make phpstan) - 📖 Update documentation if needed
- 📤 Submit the pull request
- 💬 Respond to review feedback
When you submit a Pull Request, GitHub Actions will automatically run:
- PHPUnit tests across the full matrix:
- PHP versions: 8.4, 8.5
- Symfony version: 8.0
- PHP-CS-Fixer for code style validation
- PHPStan for static analysis
- Code coverage report
Important
Your PR must pass all CI checks before it can be merged. If a check fails, review the logs to identify and fix the issue.
Tip
Run make tests php=8.4 and make tests php=8.5 locally before pushing to catch compatibility issues early.
Tests are highly encouraged and often required for new features or bug fixes:
- 📁 Place tests in the
tests/directory, mirroring thesrc/structure - 📝 Use meaningful test method names that describe the behavior being tested
- ✅ Include both positive and negative test cases
- 🔍 Test edge cases and error conditions
Test Structure Example:
namespace DH\AuditorBundle\Tests\Controller;
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
final class ViewerControllerTest extends WebTestCase
{
public function testAuditListIsAccessible(): void
{
$client = static::createClient();
$client->request('GET', '/audit');
$this->assertResponseIsSuccessful();
}
public function testAuditListRequiresAuthentication(): void
{
// ...
}
}Running Your Tests:
# Run only your new tests
make tests args='--filter=ViewerControllerTest'
# Run with coverage to ensure good test coverage
composer test:coverageWhen reporting bugs, please include:
- 📦 auditor-bundle version -
composer show damienharper/auditor-bundle - 📦 auditor version -
composer show damienharper/auditor - 🐘 PHP version -
php -v - 🎵 Symfony version -
composer show symfony/framework-bundle - 📋 Steps to reproduce - Minimal code example
- ✅ Expected behavior - What should happen
- ❌ Actual behavior - What actually happens
- 📝 Error messages - Full stack trace if available
For feature requests:
- 🔍 Check existing issues to avoid duplicates
- 📝 Describe the use case
- 💭 Explain why existing features don't meet your needs
- 🔧 Suggest a possible implementation if you have ideas
Documentation lives in the docs/ directory and uses Markdown.
- ✅ Use clear, simple language
- ✅ Include code examples
- ✅ Add internal links to related content
- ✅ Use standard Markdown tables with pipes
- ✅ Test all code examples
- Open a GitHub Issue
- Check existing issues first
- Be patient - maintainers are volunteers
By contributing, you agree that your contributions will be licensed under the MIT License.