Project Zero

Excellent PHP best practices

Excellent post on This interests me: A collection of useful best practices in modern PHP development, like

This post will lift your development level dramatically. There’s a lot of stuff that could be added like writing code that perfectly fits the PSR-guidelines, or Composer, or Vagrant etc, but in general the information given is extremely useful and if you start practicing these definitely will help when you work in team and improve coding standers understanding

  1. Redirecting the user via header() after a form submit (to prevent resubmitting POST data)
  2. Getting rid of the outdated mysql_* functions
  3. PSR-styles, like not closing PHP tags
  4. Anti-XSS
  5. DRY coding
  6. separating application logic and output
  7. using prepared statements instead of old-school mySQL queries
  8. using try/catch instead of die() and exit()
  9. working with git
  10. caching
  11. design patterns
  12. utf-8
  13. learning to love and use frameworks
  14. security
  15. application testing
  16. documentation
  17. server-side validation
  18. error reporting

 

Exit mobile version