|
| 1 | +# Contributing to PHP MVC Framework |
| 2 | + |
| 3 | +First off, thank you for considering contributing to this project! It's people like you that make this project such a great tool. |
| 4 | + |
| 5 | +## Code of Conduct |
| 6 | + |
| 7 | +This project and everyone participating in it is governed by respect and professionalism. By participating, you are expected to uphold this code. |
| 8 | + |
| 9 | +## How Can I Contribute? |
| 10 | + |
| 11 | +### Reporting Bugs |
| 12 | + |
| 13 | +Before creating bug reports, please check the existing issues as you might find out that you don't need to create one. When you are creating a bug report, please include as many details as possible: |
| 14 | + |
| 15 | +* **Use a clear and descriptive title** for the issue |
| 16 | +* **Describe the exact steps to reproduce the problem** |
| 17 | +* **Provide specific examples** to demonstrate the steps |
| 18 | +* **Describe the behavior you observed** and what behavior you expected to see |
| 19 | +* **Include screenshots** if relevant |
| 20 | +* **Include your environment details** (PHP version, database version, web server) |
| 21 | + |
| 22 | +### Suggesting Enhancements |
| 23 | + |
| 24 | +Enhancement suggestions are tracked as GitHub issues. When creating an enhancement suggestion, please include: |
| 25 | + |
| 26 | +* **Use a clear and descriptive title** |
| 27 | +* **Provide a step-by-step description** of the suggested enhancement |
| 28 | +* **Provide specific examples** to demonstrate the steps |
| 29 | +* **Describe the current behavior** and **explain the behavior you would like to see** |
| 30 | +* **Explain why this enhancement would be useful** |
| 31 | + |
| 32 | +### Pull Requests |
| 33 | + |
| 34 | +* Fill in the required template |
| 35 | +* Follow the PHP coding standards (PSR-12) |
| 36 | +* Include thoughtful comments in your code |
| 37 | +* End all files with a newline |
| 38 | +* Write meaningful commit messages |
| 39 | + |
| 40 | +## Development Process |
| 41 | + |
| 42 | +1. **Fork the repository** and create your branch from `main` |
| 43 | +2. **Make your changes** following the coding standards |
| 44 | +3. **Test your changes** thoroughly |
| 45 | +4. **Update documentation** if needed |
| 46 | +5. **Commit your changes** with clear commit messages |
| 47 | +6. **Push to your fork** and submit a pull request |
| 48 | + |
| 49 | +### Setting Up Your Development Environment |
| 50 | + |
| 51 | +```bash |
| 52 | +# Clone your fork |
| 53 | +git clone https://github.com/YOUR-USERNAME/PHP-MVC-03.git |
| 54 | +cd PHP-MVC-03 |
| 55 | + |
| 56 | +# Create a new branch |
| 57 | +git checkout -b feature/your-feature-name |
| 58 | + |
| 59 | +# Make your changes |
| 60 | +# ... |
| 61 | + |
| 62 | +# Commit your changes |
| 63 | +git add . |
| 64 | +git commit -m "Add your meaningful commit message" |
| 65 | + |
| 66 | +# Push to your fork |
| 67 | +git push origin feature/your-feature-name |
| 68 | +``` |
| 69 | + |
| 70 | +## Coding Standards |
| 71 | + |
| 72 | +### PHP Code Style |
| 73 | + |
| 74 | +* Follow [PSR-12](https://www.php-fig.org/psr/psr-12/) coding standards |
| 75 | +* Use meaningful variable and function names |
| 76 | +* Add comments for complex logic |
| 77 | +* Keep functions small and focused |
| 78 | +* Use type hints where possible (PHP 7.4+) |
| 79 | + |
| 80 | +### Example: |
| 81 | + |
| 82 | +```php |
| 83 | +<?php |
| 84 | + |
| 85 | +/** |
| 86 | + * Get user by email address |
| 87 | + * |
| 88 | + * @param string $email User's email address |
| 89 | + * @return array|false User data or false if not found |
| 90 | + */ |
| 91 | +public function getUserByEmail(string $email) |
| 92 | +{ |
| 93 | + $this->db->query('SELECT * FROM users WHERE email = :email'); |
| 94 | + $this->db->bind(':email', $email); |
| 95 | + |
| 96 | + return $this->db->single(); |
| 97 | +} |
| 98 | +``` |
| 99 | + |
| 100 | +### JavaScript Code Style |
| 101 | + |
| 102 | +* Use modern ES6+ syntax where appropriate |
| 103 | +* Use meaningful variable names |
| 104 | +* Add comments for complex logic |
| 105 | +* Use semicolons consistently |
| 106 | + |
| 107 | +### SQL |
| 108 | + |
| 109 | +* Use UPPERCASE for SQL keywords |
| 110 | +* Use prepared statements to prevent SQL injection |
| 111 | +* Use meaningful table and column names |
| 112 | + |
| 113 | +## Git Commit Messages |
| 114 | + |
| 115 | +* Use the present tense ("Add feature" not "Added feature") |
| 116 | +* Use the imperative mood ("Move cursor to..." not "Moves cursor to...") |
| 117 | +* Limit the first line to 72 characters or less |
| 118 | +* Reference issues and pull requests liberally after the first line |
| 119 | + |
| 120 | +### Examples: |
| 121 | + |
| 122 | +``` |
| 123 | +Add user authentication feature |
| 124 | +
|
| 125 | +- Implement login/logout functionality |
| 126 | +- Add session management |
| 127 | +- Create user registration form |
| 128 | +
|
| 129 | +Fixes #123 |
| 130 | +``` |
| 131 | + |
| 132 | +## Testing |
| 133 | + |
| 134 | +* Test your changes thoroughly before submitting |
| 135 | +* Include test cases if applicable |
| 136 | +* Verify that existing functionality still works |
| 137 | + |
| 138 | +## Documentation |
| 139 | + |
| 140 | +* Update the README.md if you change functionality |
| 141 | +* Comment your code where necessary |
| 142 | +* Update inline documentation for functions and classes |
| 143 | + |
| 144 | +## Questions? |
| 145 | + |
| 146 | +Feel free to open an issue with your question or contact the maintainers directly. |
| 147 | + |
| 148 | +## Recognition |
| 149 | + |
| 150 | +Contributors will be recognized in the project's README.md file. |
| 151 | + |
| 152 | +--- |
| 153 | + |
| 154 | +Thank you for contributing! 🎉 |
0 commit comments