I didn’t go to ZendCon this year, but I just finished reading Mike Naberezny’s and Matthew Weier O’Phinney’s PHP Developer Best Practices, and it’s a pretty good compendium of what to do if your organization is developing in PHP, or perhaps you’re working on a project that has potential to attract more contributors and maybe even grow into a company.
- Use source control
- First, choose between distributed and non-distributed
- Then, if you chose non-distributed, choose between CVS and SVN
- In Subversion, use trunk/ for ongoing development and bug fixes, branches/ for ongoing large projects that later need to be merged in, and tags/ for releases
- Use svn externals to connect to remote repositories
- Subversion supports pre-commit and post-commit hooks for better code maintainability and checks
- Implement coding standards
- Develop class, variable, function, package, etc. naming conventions
- Agree on common formatting as far as spacing, braces, etc.
- Implement comment standards
- PHP_CodeSniffer can run on pre-commit to check whether the commit adheres to the standards
- Don’t forget to enforce coding standards on any outsourced projects
- Unit testing and code coverage
- Use PHPUnit for unit testing
- For continuous integration, check out phpUnderControl
- For integration testing, check out Selenium, a general Web application testing suite
- Documentation
- Don’t invent your own standards, see what phpDocumentor has to offer. Doxygen also supports phpDoc tags
- For documenting the software project, try DocBook – XML-based format that allows you to quickly publish a PDF document, or a Website with documentation
- Deployment
- Have a standard deployment process that a rookie can familiarize with quickly
- Support 3 environments – development, staging, and production
- Deploy code only from repository tags, don’t run trunk, or allow code editing on server
- Check out a new tag from SVN, point the symlink to it. If something goes wrong during release, change the symlink back to the previous version – easy rollback strategy
- Everything that needs to be done on the production servers needs to be automated
- You can do another Selenium test after the release is deployed
- Check out Monit and Supervisord for deployment monitoring

Do you know if audio/video versions of those presentations are available?