|
| 1 | +# Contributing to Berlioz Framework |
| 2 | + |
| 3 | +First off, thank you for considering contributing to the Berlioz Framework! Every contribution helps make Berlioz |
| 4 | +better for everyone. |
| 5 | + |
| 6 | +## Monorepo |
| 7 | + |
| 8 | +This repository is a **monorepo** that contains all official Berlioz packages. Sub-repositories (e.g. |
| 9 | +`berlioz/core`, `berlioz/router`, etc.) are **read-only mirrors** that are synchronized automatically. |
| 10 | + |
| 11 | +**All contributions (bug reports, feature requests, pull requests) must be made on this repository.** |
| 12 | + |
| 13 | +## Reporting bugs |
| 14 | + |
| 15 | +Before opening a new issue, please check if a similar issue already exists. |
| 16 | + |
| 17 | +When reporting a bug, please include: |
| 18 | + |
| 19 | +- The PHP version you are using. |
| 20 | +- The Berlioz version (or commit hash). |
| 21 | +- A clear description of the expected behavior and what actually happened. |
| 22 | +- Steps to reproduce the issue, ideally with a minimal code example. |
| 23 | + |
| 24 | +## Suggesting features |
| 25 | + |
| 26 | +Feature requests are welcome. Open an issue with the `enhancement` label and describe: |
| 27 | + |
| 28 | +- The problem you are trying to solve. |
| 29 | +- How you envision the solution. |
| 30 | +- Any alternatives you have considered. |
| 31 | + |
| 32 | +## Pull requests |
| 33 | + |
| 34 | +### Getting started |
| 35 | + |
| 36 | +1. **Fork** the repository and clone your fork locally. |
| 37 | +2. Install dependencies: |
| 38 | + ```bash |
| 39 | + composer install |
| 40 | + ``` |
| 41 | +3. Create a **new branch** from `main`: |
| 42 | + ```bash |
| 43 | + git checkout -b my-feature |
| 44 | + ``` |
| 45 | + |
| 46 | +### Coding standards |
| 47 | + |
| 48 | +- PHP code must follow **PSR-12** coding style. |
| 49 | +- Use `declare(strict_types=1);` in every PHP file. |
| 50 | +- Indentation: 4 spaces for PHP files, 2 spaces for other files (see `.editorconfig`). |
| 51 | +- Maximum line length: 120 characters for PHP files. |
| 52 | +- Import classes with `use` statements; do not use fully qualified names in code. |
| 53 | + |
| 54 | +### Tests |
| 55 | + |
| 56 | +All changes must be covered by tests. The project uses **PHPUnit 11**. |
| 57 | + |
| 58 | +```bash |
| 59 | +# Run the full test suite |
| 60 | +vendor/bin/phpunit |
| 61 | + |
| 62 | +# Run tests for a specific package |
| 63 | +vendor/bin/phpunit --testsuite "Berlioz Router test suite" |
| 64 | +``` |
| 65 | + |
| 66 | +Make sure all tests pass before submitting your pull request: |
| 67 | + |
| 68 | +```bash |
| 69 | +vendor/bin/phpunit --coverage-text |
| 70 | +``` |
| 71 | + |
| 72 | +### Static analysis |
| 73 | + |
| 74 | +The project uses **Rector** for automated code quality checks: |
| 75 | + |
| 76 | +```bash |
| 77 | +# Check for issues (dry run) |
| 78 | +vendor/bin/rector --dry-run |
| 79 | + |
| 80 | +# Apply fixes |
| 81 | +vendor/bin/rector |
| 82 | +``` |
| 83 | + |
| 84 | +### Commit messages |
| 85 | + |
| 86 | +- Use clear, descriptive commit messages. |
| 87 | +- Start with a short summary (max 72 characters). |
| 88 | +- Use the imperative mood ("Add feature", not "Added feature"). |
| 89 | +- Reference related issues when applicable (e.g. `Fix #42`). |
| 90 | + |
| 91 | +### Submitting |
| 92 | + |
| 93 | +1. Make sure the test suite passes. |
| 94 | +2. Push your branch to your fork. |
| 95 | +3. Open a **pull request** against the `main` branch of this repository. |
| 96 | +4. Describe your changes clearly in the pull request description. |
| 97 | +5. Be prepared to address feedback during code review. |
| 98 | + |
| 99 | +## Development setup |
| 100 | + |
| 101 | +### Requirements |
| 102 | + |
| 103 | +- PHP >= 8.2 |
| 104 | +- Extensions: `fileinfo`, `intl`, `mbstring`, `xml` |
| 105 | +- Composer v2 |
| 106 | + |
| 107 | +### Optional extensions |
| 108 | + |
| 109 | +Some packages require additional extensions for their full test suite: |
| 110 | + |
| 111 | +- `yaml` -- Config YAML adapter |
| 112 | +- `amqp` -- Queue Manager AMQP driver |
| 113 | +- `redis` -- Queue Manager Redis driver |
| 114 | +- `curl` -- HTTP Client CURL adapter |
| 115 | + |
| 116 | +## Code of conduct |
| 117 | + |
| 118 | +Please be respectful and constructive in all interactions. We are committed to providing a welcoming and inclusive |
| 119 | +experience for everyone. |
| 120 | + |
| 121 | +## Questions? |
| 122 | + |
| 123 | +If you have any questions, feel free to open an issue or reach out via the project website at |
| 124 | +[getberlioz.com](https://getberlioz.com). |
0 commit comments