Contributing Guide

Thank you for considering contributing to Mono CLI! This document outlines the process and guidelines for contributing.

Code of Conduct

Be respectful, inclusive, and professional in all interactions.

Getting Started

  1. Fork the repository

  2. Clone your fork: git clone https://github.com/your-username/mono-php.git

  3. Create a feature branch: git checkout -b feature/your-feature-name

  4. Install dependencies: cd cli && composer install

Development Workflow

Before Making Changes

  1. Ensure all tests pass: composer test

  2. Check code quality: composer check

Making Changes

  1. Write clean, well-documented code

  2. Follow PSR-12 coding standards

  3. Add comprehensive docblocks to all classes and methods

  4. Write unit tests for new functionality

  5. Update documentation as needed

Code Style

We use Laravel Pint for code formatting:

Static Analysis

We use PHPStan at level 8 for static analysis:

Refactoring

We use Rector for automated refactoring:

Testing

Write comprehensive tests for all new features:

Test requirements:

  • Unit tests for all new classes and methods

  • Feature tests for command workflows

  • Minimum 80% code coverage for new code

  • All tests must pass before submitting PR

Quality Checks

Run all quality checks before committing:

Commit Guidelines

Commit Message Format

Types

  • feat: New feature

  • fix: Bug fix

  • docs: Documentation changes

  • style: Code style changes (formatting, etc.)

  • refactor: Code refactoring

  • test: Adding or updating tests

  • chore: Maintenance tasks

Examples

Pull Request Process

  1. Update documentation for any changed functionality

  2. Add tests for new features

  3. Ensure all quality checks pass: composer check

  4. Update CHANGELOG.md with your changes

  5. Submit PR with clear description of changes

  6. Link related issues in PR description

  7. Wait for code review and address feedback

PR Title Format

Use the same format as commit messages:

PR Description Template

Project Structure

Adding New Commands

  1. Create command class in appropriate directory under src/Commands/

  2. Extend BaseCommand class

  3. Implement configure() and execute() methods

  4. Add comprehensive docblocks

  5. Call parent::configure() to inherit common options

  6. Register command in Application.php if not auto-discovered

  7. Write unit tests in tests/Unit/Commands/

  8. Write feature tests in tests/Feature/

  9. Update documentation

Command Template

Documentation

  • Update README.md for user-facing changes

  • Update inline code documentation (docblocks)

  • Add examples for new features

  • Update CHANGELOG.md

Questions?

  • Open an issue for bugs or feature requests

  • Start a discussion for questions or ideas

  • Check existing issues before creating new ones

License

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

Last updated