Lesson Monday

A complete list of naming conventions for PHP projects:

  • Variables: use lower_snake_case when naming all variables. For example, hockey_game.
  • Functions: use lowerCamelCase when naming functions. For example, playHockeyGame.
  • Class names: use UpperCamelCase when naming classes. For example, HockeyGame.
  • Class file names: use UpperCamelCase when naming class files. For example, HockeyGame.php.
  • Test variables: use lower_snake_case but start with test. For example, test_hockey_game.
  • Test functions: use lowerCamelCase starting with test followed by a description of the functionality of the function. For example, testPlayHockey.
  • Test files: use UpperCamelCase ending with singular Test. For example, HockeyGameTest.php.
  • Twig views: use lower_snake_case.html.twig. For example, index.html.twig.
  • Silex folders: use lower_snake_case. For example, app or web or tests.