RtkDev:Contribute Code

From RevTK

Jump to: navigation, search
RevTK Developers Hub
All articles

Testing your code

Run the website with index_dev.php and index_test.php. Sometimes, php code doesn't work when debugging is off. Soft errors will be caught and halt the page or even return a blank page. Try to find code that generates soft errors or php warnings.


Coding Guidelines

The more you follow existing code's conventions the less likely the code will be refactored or moved around when merged into the master branch, and the sooner it will be included in the next website public releases.

But don't let any guidelines discourage you from contributing: whatever is your programming experience in php or web development, the most important is to submit code that works.

  • Code for maintainability
    • Document your code. At the very least try to document the function signature (@param, @return) for public functions, and add a brief description line at the top of each class or file.
    • Don't optimize early. Optimizing the database queries and database structure as well as the number of requests on a page (images, scripts, ajax..) is almost always a better way to optimize a web application, than optimizing php code.
    • Use coding standards. RevTK's coding style is largely inspired by the Symfony coding standards, and php code from Fabien Potencier. Remember that those are guidelines, not rules. The only rule is indentation (no spaces and soft tab size 2), because loosing indentation in templates and php classes is a huge waste of time, and also causes problems with merges.
  • Communicate
    • Tell us what you are working on. Participate in the developer forum, you will get suggestions and feedback from users and other contributors, as well as help to get around the codebase for whichever feature you are working on.
Personal tools