Files
preauth/CONTRIBUTING.md
T
lyra 408d75dda1
Sync GitHub / sync (push) Successful in 8s
chore: nice-to-have improvements for v1.0
Code quality:
- Create AppConstants class with shared constants:
  - FAR_FUTURE_DATE (replaces duplicated '2999-12-31' strings)
  - MAX_INPUT_LENGTH (replaces duplicated 128 in Payload and StringTrait)
- Extract duplicated 'hi $id' response body into StringTrait::authSuccessResponse()
  method, used by AcceptListener, AllowListener, and LoginManager
- Add missing @throws InvalidArgumentException annotations to
  MonitorCacheKeys (getItem, hasItem, deleteItem, deleteItems, commit)

Configuration:
- Add proper env var type casting in services.yaml:
  - COOKIE_TTL → env(int:)
  - SUBDOMAIN_REDIRECT → env(bool:)
  - IP_TTL → env(int:)
  - TEAPOT → env(bool:)

Documentation:
- Create CONTRIBUTING.md with development setup, code style,
  testing guidelines, and PR process
2026-08-11 16:37:23 -04:00

1.9 KiB

Contributing to Preauth

Thank you for your interest in contributing to Preauth! This document outlines the process for contributing to the project.

Development Setup

  1. Clone the repository
  2. Install dependencies: composer install
  3. Copy .env.example to .env and configure as needed
  4. Run tests: vendor/bin/phpunit

Code Style

This project follows PSR-12 and includes php-cs-fixer as a dev dependency.

# Check for style violations
vendor/bin/php-cs-fixer fix --dry-run --diff

# Auto-fix
vendor/bin/php-cs-fixer fix

All code must pass the style check before it can be merged.

Testing

All code changes must include tests. The project maintains 100% code coverage — new code must be fully tested.

# Run tests
vendor/bin/phpunit

# Run with coverage (requires Xdebug)
XDEBUG_MODE=coverage vendor/bin/phpunit --coverage-text

Test Structure

  • Unit tests go in tests/Unit/ and mirror the src/ directory structure
  • Functional tests go in tests/Functional/ and test the full HTTP kernel
  • Use the support traits (TotpTestHelper, ListenerTestHelper) for reusable test fixtures

Pull Request Process

  1. Create a feature branch from main
  2. Make your changes, ensuring tests pass and code style is clean
  3. Update documentation if needed (README, CHANGELOG, docs/)
  4. Submit a pull request to main

Commit Messages

Use conventional commit format:

  • feat: new feature
  • fix: bug fix
  • docs: documentation only
  • refactor: code change that neither fixes a bug nor adds a feature
  • test: adding or correcting tests
  • chore: build process, tooling, etc.

Architecture

Preauth is an event-listener-driven Symfony application (no controllers). See ROADMAP.md for the full architecture overview and design decisions.

License

By contributing, you agree that your contributions will be licensed under the MIT License.