|
| 1 | +# Contributing to Quantum PHP Framework |
| 2 | + |
| 3 | +Thanks for your interest in contributing to Quantum PHP Framework 💡 Whether you’re fixing a bug, adding a feature, or improving docs — every contribution helps make the framework stronger. |
| 4 | + |
| 5 | +--- |
| 6 | + |
| 7 | +## Before You Start |
| 8 | + |
| 9 | +Familiarize yourself with the codebase: Quantum PHP Framework is modular — most features live under `/src` (core logic) and `/modules` (demo templates and optional components). Start by reviewing the `Router`, `Controller`, and `QtModel` classes to understand the framework flow. |
| 10 | +Check existing issues and milestones: look for tickets labeled `good first issue`, `help wanted`, or assigned to an upcoming version. |
| 11 | +Don’t hesitate to open a new issue if you find something worth improving. |
| 12 | + |
| 13 | +--- |
| 14 | + |
| 15 | +## Local Setup (Fork-Based) |
| 16 | + |
| 17 | +1. Fork the repository on GitHub and clone your fork locally: |
| 18 | + |
| 19 | +```bash |
| 20 | +git clone https://github.com/your-username/quantum-php-core.git |
| 21 | +cd quantum-php-core |
| 22 | +composer install |
| 23 | +php qt serve |
| 24 | +``` |
| 25 | + |
| 26 | +You should see the demo project running on `http://127.0.0.1:8000`. |
| 27 | + |
| 28 | +--- |
| 29 | + |
| 30 | +## Development Workflow |
| 31 | + |
| 32 | +1. Create a new branch in your fork: |
| 33 | + |
| 34 | +```bash |
| 35 | +git checkout -b feature/your-feature-name |
| 36 | +``` |
| 37 | + |
| 38 | +2. Make your changes — keep code style consistent (PSR-12, no unnecessary dependencies), prefer anonymous functions when working with callbacks to preserve `$this` context, and add or update unit tests if your change affects logic. |
| 39 | + |
| 40 | +3. Run tests: |
| 41 | + |
| 42 | +```bash |
| 43 | +vendor/bin/phpunit --stderr |
| 44 | +``` |
| 45 | + |
| 46 | +4. Commit and push your branch: |
| 47 | + |
| 48 | +```bash |
| 49 | +git commit -m "Add: SoftDeletes trait for models" |
| 50 | +git push origin feature/your-feature-name |
| 51 | +``` |
| 52 | + |
| 53 | +5. Open a Pull Request from your fork → `softberg/quantum-php-core`. Describe **what** you changed, **why**, and **how** to test it. Reference any related issues. Always work in a branch, never directly on `main` of your fork. |
| 54 | + |
| 55 | +--- |
| 56 | + |
| 57 | +## Testing |
| 58 | + |
| 59 | +Quantum uses PHPUnit for tests. If you add new features, make sure they include unit tests — especially for database or HTTP-related components. For in-memory testing, use SQLite in-memory databases (for example, in tests using IdiormDbal). |
| 60 | + |
| 61 | +--- |
| 62 | + |
| 63 | +## Code Guidelines |
| 64 | + |
| 65 | +- PHP 7.3+ compatibility is required. |
| 66 | +- Keep class responsibilities clear — avoid bloated classes. |
| 67 | +- Follow the existing directory structure |
| 68 | +- Always document public methods. |
| 69 | +- Avoid breaking backward compatibility unless discussed. |
| 70 | + |
| 71 | +--- |
| 72 | + |
| 73 | +## Modules & Components |
| 74 | + |
| 75 | +Modules in Quantum are self-contained MVC units. When building or modifying modules, keep reusable logic in `/src/Core`, use CLI commands (`DemoCommand`, `CreateUserCommand`, `CreatePostCommand`, etc.) for setup, and test module installation flow end-to-end before submitting. |
| 76 | + |
| 77 | +--- |
| 78 | + |
| 79 | +## Communication |
| 80 | + |
| 81 | +Open a GitHub issue for discussions or questions before large changes. Use clear and respectful communication — feedback is always welcome. |
| 82 | + |
| 83 | +--- |
| 84 | + |
| 85 | +## Recognition |
| 86 | + |
| 87 | +Contributors are listed in `CONTRIBUTORS.md` and mentioned in release notes. Active contributors may be invited as reviewers or maintainers. If you build something cool using Quantum PHP Framework, we’d love to feature it! |
| 88 | + |
| 89 | +--- |
| 90 | + |
| 91 | +> “Code is written once, but read many times.” Keep it clean, minimal, and purposeful. |
| 92 | +
|
| 93 | +Happy coding ⚡ |
| 94 | +— The Quantum PHP Team |
0 commit comments