Contributing
How to contribute to auditor-doctrine-provider
Thank you for your interest in contributing! This guide explains how to set up the development environment and submit contributions.
๐ ๏ธ Development Setupโ
Prerequisitesโ
- Docker and Docker Compose (recommended for CI parity)
- Make
- PHP >= 8.4 (for local development without Docker)
Clone and Installโ
git clone https://github.com/DamienHarper/auditor-doctrine-provider.git
cd auditor-doctrine-provider
composer install
Run the Testsโ
# Run tests locally with SQLite (no Docker needed)
composer test
# Run tests with Docker (CI parity)
make tests
# Run tests with MySQL
make tests db=mysql
# Run tests with PostgreSQL
make tests db=pgsql
# Run tests with MariaDB
make tests db=mariadb
# Run tests with a specific PHP version
make tests php=8.5
# Run a specific test class
vendor/bin/phpunit --filter=ReaderTest
# Run a specific test method
vendor/bin/phpunit --filter=testMethodName
Run QA Toolsโ
# Run all QA tools (rector + cs-fix + phpstan)
composer qa
# Run individually
composer rector
composer cs-fix
composer phpstan
# Dry-run rector (preview changes without applying)
composer rector-check
NOTE
PHPStan, php-cs-fixer, and rector each have their own isolated Composer project under tools/. The composer scripts call them via tools/ paths automatically โ do not call them directly via vendor/bin/.
๐ Coding Standardsโ
This project follows Symfony coding standards and is enforced by php-cs-fixer. Run composer cs-fix before submitting a pull request.
PHPStan runs at level max; all new code must be fully type-hinted.
๐ท๏ธ Commit Messagesโ
Use Conventional Commits:
feat: add support for inheritance discriminator in audit table
fix: ensure ManyToMany dissociations are captured correctly
test: add MySQL integration tests for SchemaManager
docs: document multi-database setup
chore: bump phpunit to ^12.0
๐ Pull Request Processโ
- Fork the repository
- Create a branch from
main:git checkout -b feat/my-feature - Write tests for any new functionality
- Run QA to ensure your changes pass all checks:
composer qa
composer test - Submit a pull request against
main
๐งช Writing Testsโ
Tests live in tests/ and mirror the src/ structure. The test suite uses PHPUnit and relies on SchemaSetupTrait to bootstrap a Doctrine EntityManager and audit schema.
The database connection is driven by the DATABASE_URL environment variable. Tests fall back to SQLite :memory: when DATABASE_URL is not set.
# Run with coverage
composer test:coverage
# Run in testdox format
composer testdox
๐ Supported PHP Versionsโ
| PHP Version | Status |
|---|---|
| 8.4 | โ Tested |
| 8.5 | โ Tested |
๐ Licenseโ
By contributing, you agree that your contributions will be licensed under the MIT License.
Related Projectsโ
- auditor โ Core library
- auditor-bundle โ Symfony bundle