You are currently browsing documentation for Diem 5.1 - Switch to version5.0

Conventions

More automation, less configuration : the key is convention

Conventions are useful. Not only they allow the code to be clean and consistent, but they also allow a lot of automation.

Diem follows all symfony conventions, and adds some.

Syntaxes

When naming something in the code ( a model, a module, a variable, a method... ), there are three ways to do it:

Underscored

Lowercase, words separated by an underscore.

this_is_an_underscored_word

When use the underscore syntax ?

  • database table names
  • database field names
  • php functions ( typically helper functions )
  • array keys ( like dependency injection service parameters )

Camelized

Uppercased first letter, words separated by an uppercased letter.

ThisIsAnUppercasedWord

When use the camelized syntax ?

  • models class name

Modulized

Lowercased first letter, words separated by an uppercased letter.

thisIsAModulizedWord

When use the modulized syntax ?

  • methods
  • variables
  • modules
  • templates
  • non model class names

Conversion

Diem provides methods to transform a string from a syntax to another one.

dmString::underscore($string) // transform $string to underscored syntax
dmString::camelize($string)   // transform $string to camelized syntax  
dmString::modulize($string)   // transform $string to modulized syntax  

Coding standarts

All the symfony coding stadarts are applied and recommended, without any addition.

Learn about symfony coding standarts

Questions and Feedback

If you need support or have a technical question, you can

  • Get help with the Google Group
  • Get help with the Forum
  • Come and chat on the #diem IRC channel on freenode

The documentation is hosted on GitHub. Feel free to submit issues and patches!

Fork Diem on GitHub