- Star the project!
- Answer questions that come through GitHub issues
- Report a bug that you find.
- Share a theme you’ve built with Timber. This helps transfer knowledge about best practices, etc. Add it to the Showcase list.
- Tweet and blog about the advantages (and criticisms) of the project and Twig.
- Browse contrib opportunities for areas of WordPress/PHP/code you know well to consider, build or document.
- Answer questions on Stack Overflow posted under the «Timber» tag. You can also subscribe to a tag via email to get notified when someone needs help.
- Answer question in the support channel on Gitter.
Pull requests are highly appreciated. More than fifty people have written parts of Timber (so far). Here are some guidelines to help:
- Solve a problem – Features are great, but even better is cleaning-up and fixing issues in the code that you discover.
- Write tests – This helps preserve functionality as the codebase grows and demonstrates how your change affects the code.
- Small > big – Better to have a few small pull requests that address specific parts of the code, than one big pull request that jumps all over.
- Comply with Coding Standards – See next section.
We try to follow the WordPress Coding Standards as close as we can, with the following exceptions:
- Class and file names are defined in
StudlyCaps
. We follow the PSR-0 standard, because we use autoloading via Composer. - We use hook names namespaced by
/
instead of underscores (e.g.timber/context
instead oftimber_context
).
We follow the WordPress Inline Documentation Standards. The Reference section of the documentation is automatically generated from the inline documentation of the Timber code base. That’s why we allow Markdown in the PHPDoc blocks.
To check where the code deviates from the standards, you can use PHP_CodeSniffer. Timber comes with a phpcs.xml
in the root folder of the repository, so that the coding standards will automatically be applied for the Timber code base.
- Install PHP_CodeSniffer globally by following this guide: https://github.com/squizlabs/PHP_CodeSniffer#installation.
- Install WPCS by following this guide: https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards#installation.
To run PHP_CodeSniffer with the default settings on all relevant Timber files, use the following command from the root folder of the Timber library:
phpcs
You could check a single file like this:
phpcs ./lib/Menu.php
Use phpcs --help
for a list of available settings.
Please refer to https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards#how-to-use for different ways to use PHP_CodeSniffer directly in your IDE. In some IDEs like PHPStorm, you may have to select the phpcs.xml
explicitly to apply the proper standards.
If it’s not possible to adapt to certain rules, code could be whitelisted. However, this should be used sparingly.