|
| 1 | +# 🤝 Contributing to **maatify/bootstrap** |
| 2 | + |
| 3 | +Thank you for your interest in contributing to **maatify/bootstrap** — |
| 4 | +the unified initialization, environment loading, and diagnostics layer powering the entire **Maatify ecosystem**. |
| 5 | + |
| 6 | +Your contributions help ensure that all Maatify projects start consistently, securely, and predictably across local, testing, and production environments. |
| 7 | + |
| 8 | +--- |
| 9 | + |
| 10 | +## 🧩 Development Standards |
| 11 | + |
| 12 | +Please follow the standards below to keep the library clean, stable, and production-ready. |
| 13 | + |
| 14 | +--- |
| 15 | + |
| 16 | +## ⚙️ Code Style |
| 17 | + |
| 18 | +* Follow **[PSR-12](https://www.php-fig.org/psr/psr-12/)** standards. |
| 19 | +* All PHP files must include: |
| 20 | + |
| 21 | + ```php |
| 22 | + declare(strict_types=1); |
| 23 | + ``` |
| 24 | +* All new classes should be declared **final** unless extensibility is explicitly required. |
| 25 | +* Add clear and consistent **DocBlocks** for: |
| 26 | + |
| 27 | + * Classes |
| 28 | + * Methods |
| 29 | + * Properties |
| 30 | + * Exceptions |
| 31 | +* Avoid introducing global state — use dependency injection where possible. |
| 32 | +* Keep the bootstrap logic **idempotent** (initializes once per runtime). |
| 33 | + |
| 34 | +--- |
| 35 | + |
| 36 | +## 🧪 Testing |
| 37 | + |
| 38 | +Bootstrap controls the startup of the entire Maatify stack — |
| 39 | +therefore, **every change must be covered with PHPUnit tests**. |
| 40 | + |
| 41 | +* Run the full test suite before submitting PRs: |
| 42 | + |
| 43 | + ```bash |
| 44 | + vendor/bin/phpunit |
| 45 | + ``` |
| 46 | +* Required coverage: **≥95%**. |
| 47 | +* Tests must cover: |
| 48 | + |
| 49 | + * Environment loading priority |
| 50 | + * No-override safety |
| 51 | + * Timezone fallback behavior |
| 52 | + * Safe Mode detection |
| 53 | + * Bootstrap initialization idempotency |
| 54 | + |
| 55 | +If your PR introduces environment-sensitive logic, include tests for: |
| 56 | + |
| 57 | +* When `.env.local` is present |
| 58 | +* When `.env.testing` is present |
| 59 | +* When no `.env` file exists |
| 60 | +* When variables are pre-loaded via `putenv()` / `$_ENV` |
| 61 | + |
| 62 | +--- |
| 63 | + |
| 64 | +## 📚 Documentation |
| 65 | + |
| 66 | +* All new features require documentation under `/docs/`. |
| 67 | +* If a core phase is changed, update the corresponding |
| 68 | + `docs/README.phaseX.md` file (e.g., phase for diagnostics, loader, helpers). |
| 69 | +* Major changes must be reflected in: |
| 70 | + |
| 71 | + * `README.md` (public summary) |
| 72 | + * `docs/README.full.md` (developer documentation) |
| 73 | + |
| 74 | +Use fenced code blocks for examples: |
| 75 | + |
| 76 | +```php |
| 77 | +Bootstrap::init(); |
| 78 | +``` |
| 79 | + |
| 80 | +--- |
| 81 | + |
| 82 | +## 🧾 Changelog Rules |
| 83 | + |
| 84 | +Every PR must update **[CHANGELOG.md](CHANGELOG.md)** under: |
| 85 | + |
| 86 | +* `### Added` |
| 87 | +* `### Changed` |
| 88 | +* `### Fixed` |
| 89 | +* `### Removed` |
| 90 | + |
| 91 | +Example: |
| 92 | + |
| 93 | +```md |
| 94 | +### Fixed |
| 95 | +- Prevented `.env.testing` from loading during production bootstrap. |
| 96 | +``` |
| 97 | + |
| 98 | +Versioning follows **Semantic Versioning (SemVer)**: |
| 99 | + |
| 100 | +* `MAJOR`: Breaking changes |
| 101 | +* `MINOR`: New features (no breaking changes) |
| 102 | +* `PATCH`: Fixes or improvements |
| 103 | + |
| 104 | +--- |
| 105 | + |
| 106 | +## 🪄 Commit Message Format |
| 107 | + |
| 108 | +Follow conventional commits: |
| 109 | + |
| 110 | +| Type | Meaning | Example | |
| 111 | +| -------- | -------------------------- | -------------------------------------- | |
| 112 | +| `feat:` | New feature | `feat: add SafeMode diagnostics` | |
| 113 | +| `fix:` | Bug fix | `fix: prevent .env override in loader` | |
| 114 | +| `docs:` | Documentation update | `docs: improve bootstrap examples` | |
| 115 | +| `test:` | Adding or updating tests | `test: cover timezone fallback` | |
| 116 | +| `chore:` | Maintenance, CI, versions… | `chore(release): prepare v1.0.2` | |
| 117 | + |
| 118 | +--- |
| 119 | + |
| 120 | +## 🧭 Branch Naming Guidelines |
| 121 | + |
| 122 | +| Purpose | Prefix Example | |
| 123 | +| ------- | ---------------------------- | |
| 124 | +| Feature | `feature/env-loader-upgrade` | |
| 125 | +| Fix | `fix/timezone-override` | |
| 126 | +| Docs | `docs/add-diagnostics-guide` | |
| 127 | +| Release | `release/v1.0.2` | |
| 128 | + |
| 129 | +--- |
| 130 | + |
| 131 | +## 🔀 Pull Request Process |
| 132 | + |
| 133 | +1. Fork the repository. |
| 134 | +2. Create a branch with a proper prefix. |
| 135 | +3. Add/update tests for all new logic. |
| 136 | +4. Update `/docs/` and `README.md` if needed. |
| 137 | +5. Update `CHANGELOG.md`. |
| 138 | +6. Ensure all CI checks pass. |
| 139 | +7. Submit your PR with: |
| 140 | + |
| 141 | + * Clear summary |
| 142 | + * Explanation of what changed and why |
| 143 | + * Screenshots/logs if relevant |
| 144 | + |
| 145 | +PRs without tests or documentation will be requested for revision. |
| 146 | + |
| 147 | +--- |
| 148 | + |
| 149 | +## 🪪 License & Attribution |
| 150 | + |
| 151 | +By contributing, you agree that your code will be licensed under the **MIT License** and attributed to **Maatify.dev**. |
| 152 | + |
| 153 | +--- |
| 154 | + |
| 155 | +## 👤 Maintainer |
| 156 | + |
| 157 | +**Mohamed Abdulalim ([@megyptm](https://github.com/megyptm))** |
| 158 | +Backend Lead & Technical Architect |
| 159 | +📧 [mohamed@maatify.dev](mailto:mohamed@maatify.dev) |
| 160 | +🌐 [https://www.maatify.dev](https://www.maatify.dev) |
| 161 | + |
| 162 | +**© 2025 Maatify.dev — All Rights Reserved** |
| 163 | +Engineered with precision & consistency for the entire Maatify ecosystem. |
| 164 | + |
| 165 | +📘 Full documentation & source code: |
| 166 | +🔗 [https://github.com/Maatify/bootstrap](https://github.com/Maatify/bootstrap) |
| 167 | + |
| 168 | +--- |
| 169 | + |
| 170 | +> 🚀 **Consistency starts here.** |
| 171 | +> Your contributions help bootstrap the entire Maatify ecosystem. |
| 172 | +
|
| 173 | +--- |
| 174 | + |
| 175 | +<p align="center"> |
| 176 | + <sub><span style="color:#777">Built with ❤️ by <a href="https://www.maatify.dev">Maatify.dev</a> — Unified Ecosystem for Modern PHP Libraries</span></sub> |
| 177 | +</p> |
| 178 | + |
| 179 | + |
| 180 | + |
0 commit comments