|
| 1 | +# Contributing to `ext-php-rs` |
| 2 | + |
| 3 | +Thank you for your interest in contributing to `ext-php-rs`! We welcome contributions of all kinds: |
| 4 | + |
| 5 | +- Documentation expansion (examples in particular!) |
| 6 | +- Safety reviews (especially if you have experience with Rust and the Zend API). |
| 7 | +- Bug fixes and features. |
| 8 | +- Feature requests. |
| 9 | +- And more! |
| 10 | + |
| 11 | +If you have bigger changes in mind, please open an issue first to discuss the change with us. |
| 12 | + |
| 13 | +## Git Hooks |
| 14 | + |
| 15 | +To catch common mistakes, we use git hooks to run checks before commits and pushes. |
| 16 | +For this we use [lefthook](https://github.com/evilmartians/lefthook). See |
| 17 | +[the installation docs](https://lefthook.dev/installation/) for instructions on how to install it on |
| 18 | +your system. |
| 19 | + |
| 20 | +After installing lefthook, you can run the following command to install the hooks: |
| 21 | + |
| 22 | +```bash |
| 23 | +lefthook install |
| 24 | +``` |
| 25 | + |
| 26 | +### Dependencies |
| 27 | + |
| 28 | +- When changing the `allowed_bindings.rs`, you need to have `docker` and `buildx` installed. This is required to |
| 29 | + build the bindings in a consistent environment. See the [installation guide](https://docs.docker.com/engine/install/) |
| 30 | + for instructions on how to install Docker. |
| 31 | + |
| 32 | +## Testing |
| 33 | + |
| 34 | +We have both unit and integration tests. When contributing, please ensure that your changes are at least |
| 35 | +covered by an integration test. If possible, add unit tests as well. This might not always be possible |
| 36 | +due to the need of a running PHP interpreter. |
| 37 | + |
| 38 | +### State of unit tests |
| 39 | +There are still large parts of the library that are not covered by unit tests. We strive to cover |
| 40 | +as much as possible, but this is a work in progress. If you make changes to untested code, we would |
| 41 | +appreciate it if you could add tests for the code you changed. |
| 42 | + |
| 43 | +If this is not possible, or requires a lot of unrelated changes, you don't have to add tests. However, |
| 44 | +we would appreciate it if you are able to add those tests in a follow-up PR. |
| 45 | + |
| 46 | +## Documentation |
| 47 | + |
| 48 | +Our documentation is located in the `guide` directory. |
| 49 | +If you update functionality, please ensure that the documentation is updated accordingly. |
| 50 | + |
| 51 | +### Breaking Changes |
| 52 | +If you make a breaking change, please |
| 53 | +If your change is a [breaking change](https://semver.org) a migration guide MUST be included. This |
| 54 | +MUST be placed in the `guide/src/migration-guides` directory and named `v<next-version>.md` (e.g. `v0.14.md`). |
| 55 | +This guide MUST also be linked in the `guide/src/SUMMARY.md` file under the `Migration Guides` section. |
| 56 | + |
| 57 | +## Commit Messages |
| 58 | + |
| 59 | +We are using [conventional commits](https://www.conventionalcommits.org/en/v1.0.0/) to generate our changelogs. |
| 60 | +For that reason our tooling ensures that all commit messages adhere to that standard. |
| 61 | + |
| 62 | +To make this easier you can use [convco](https://convco.github.io) to generate commit messages. |
| 63 | + |
| 64 | +## Use of AI tools |
| 65 | + |
| 66 | +- Using AI tools to generate Issues is NOT allowed. AI issues will be closed without comment. |
| 67 | +- Using AI tools to generate entire PRs is NOT allowed. |
| 68 | +- Using AI tools to generate short code snippets is allowed, but the contributor must review and understand |
| 69 | + the generated code. Think of it as a code completion tool. |
| 70 | + |
| 71 | +This is to ensure that the contributor has a good understanding of the code and its purpose. |
| 72 | + |
| 73 | +## License |
| 74 | + |
| 75 | +Unless you explicitly state otherwise, any contribution intentionally submitted |
| 76 | +for inclusion in the work by you, as defined in the Apache-2.0 license, shall be |
| 77 | +dual licensed as described in the [README](README.md#license), without any additional terms or conditions. |
0 commit comments