|
| 1 | +# Contributing to php-mcp/client |
| 2 | + |
| 3 | +First off, thank you for considering contributing to `php-mcp/client`! We appreciate your time and effort. This project aims to provide a robust and easy-to-use PHP client for the Model Context Protocol. |
| 4 | + |
| 5 | +Following these guidelines helps to communicate that you respect the time of the developers managing and developing this open-source project. In return, they should reciprocate that respect in addressing your issue, assessing changes, and helping you finalize your pull requests. |
| 6 | + |
| 7 | +## How Can I Contribute? |
| 8 | + |
| 9 | +There are several ways you can contribute: |
| 10 | + |
| 11 | +* **Reporting Bugs:** If you find a bug, please open an issue on the GitHub repository. Include steps to reproduce, expected behavior, and actual behavior. Specify your PHP version, operating system, and relevant package versions. |
| 12 | +* **Suggesting Enhancements:** Open an issue to suggest new features or improvements to existing functionality. Explain the use case and why the enhancement would be valuable. |
| 13 | +* **Improving Documentation:** If you find errors, omissions, or areas that could be clearer in the README or code comments, please submit a pull request or open an issue. |
| 14 | +* **Writing Code:** Submit pull requests to fix bugs or add new features. |
| 15 | + |
| 16 | +## Development Setup |
| 17 | + |
| 18 | +1. **Fork the repository:** Click the "Fork" button on the [php-mcp/client GitHub page](https://github.com/php-mcp/client). |
| 19 | +2. **Clone your fork: ** `git clone [email protected]:YOUR_USERNAME/client.git` |
| 20 | +3. **Navigate into the directory:** `cd client` |
| 21 | +4. **Install dependencies:** `composer install` (This installs runtime and development dependencies). |
| 22 | + |
| 23 | +## Submitting Changes (Pull Requests) |
| 24 | + |
| 25 | +1. **Create a new branch:** `git checkout -b feature/your-feature-name` or `git checkout -b fix/issue-number`. |
| 26 | +2. **Make your changes:** Write your code and accompanying tests. |
| 27 | +3. **Ensure Code Style:** Run the code style fixer (if configured, e.g., PHP CS Fixer): |
| 28 | + ```bash |
| 29 | + composer lint # Or ./vendor/bin/php-cs-fixer fix |
| 30 | + ``` |
| 31 | + Adhere to PSR-12 coding standards. |
| 32 | +4. **Run Tests:** Ensure all tests pass: |
| 33 | + ```bash |
| 34 | + composer test # Or ./vendor/bin/pest |
| 35 | + ``` |
| 36 | + Consider adding new tests for your changes. Aim for good test coverage. |
| 37 | +5. **Update Documentation:** If your changes affect the public API or usage, update the `README.md` and relevant PHPDoc blocks. |
| 38 | +6. **Commit your changes:** Use clear and descriptive commit messages. `git commit -m "feat: Add support for resource subscriptions"` or `git commit -m "fix: Correct handling of transport errors"` |
| 39 | +7. **Push to your fork:** `git push origin feature/your-feature-name` |
| 40 | +8. **Open a Pull Request:** Go to the original `php-mcp/client` repository on GitHub and open a pull request from your branch to the `main` branch (or the appropriate development branch). |
| 41 | +9. **Describe your changes:** Provide a clear description of the problem and solution in the pull request. Link to any relevant issues (`Closes #123`). |
| 42 | + |
| 43 | +## Coding Standards |
| 44 | + |
| 45 | +* Follow **PSR-12** coding standards. |
| 46 | +* Use **strict types:** `declare(strict_types=1);` at the top of PHP files. |
| 47 | +* Use **PHP 8.1+ features** where appropriate (readonly properties, enums, etc.). |
| 48 | +* Add **PHPDoc blocks** for all public classes, methods, and properties. |
| 49 | +* Write clear and concise code. Add comments only where necessary to explain complex logic. |
| 50 | + |
| 51 | +## Reporting Issues |
| 52 | + |
| 53 | +* Use the GitHub issue tracker. |
| 54 | +* Check if the issue already exists. |
| 55 | +* Provide a clear title and description. |
| 56 | +* Include steps to reproduce the issue, code examples, error messages, and stack traces if applicable. |
| 57 | +* Specify relevant environment details (PHP version, OS, package version). |
| 58 | + |
| 59 | +Thank you for contributing! |
0 commit comments