Styleguide

There are several recommended practices for writing custom code to work with Phork. Some are required while others are just suggestions.

Variable Names

Even though PHP is a loosely typed language, Phork does its best to designate each variable type by using a type of Hungarian notation. The only time this should be ignored is with temporary iterator variables. Example variable names are:

Class Naming

All Phork classes should be named like MyClassName.class.php using UpperCamelCase for both the file name and the class name.

Interface Naming

All Phork interfaces should be named like MyInterfaceName.interface.php using UpperCamelCase for both the file name and the interface name.

Class Methods

All methods within a class should be named like myClassMethod() using lowerCamelCase.

Template Naming

All templates should be named like mytemplate.phtml using lowercase with a .phtml extension.

Models Exception

Because models interact with a data source that usually contains lowercase property names the models' properties are usually also lowercase. Their formatting matches that of the data source unless explicitly overridden. When accessing a model record the preferred format is $objRecord->get('lowercase_underscore_property')

Parenthesis (optional)

Opening parenthesis should always be on the same line, and closing parenthesis should always be on a new line.

Comments (optional)

Phork has been commented using PHPdoc syntax. It is highly recommended that you comment any custom code using this same syntax.

PHP Tags (optional)

Phork has been written using long PHP tags (<?php) for optimal compatability. It's recommended that this practice be continued in your custom files, however if your server allows it you can still use short tags (<? and <?=$foo?>).