Recommended standards

The following coding standards are recommended when extending or modifying Appskull. There is no requirement to follow these rules, though they are highly recommended.

File encoding

Files should be saved with Unicode (UTF-8) encoding.

PHP closing tag

The PHP closing tag on a PHP document ?> is optional to the PHP parser. However, if used, any whitespace following the closing tag, whether introduced by the developer, user, or an FTP application, can cause unwanted output, PHP errors, or if the latter are suppressed, blank pages. For this reason, all PHP files MUST OMIT the PHP closing tag and end with a single empty line instead.

File naming

Class files must be named in a Ucfirst like manner, while any other file name (configurations, views, generic scripts, etc.) should be in all lowercase. Multiple words should concatenate with underscore.



Furthermore, class file names should match the name of the class itself. For example, if you have a class named Myclass, then its filename must be Myclass.php.

Class naming

Class names should always start with an uppercase letter. Multiple words should be separated with an underscore, and not UpperCamelCased.

Method and variable naming

Method and variable names must use lowerCamelCase.

Space between methods

Use 3 newlines between methods.


In general, code should be commented prolifically. It not only helps describe the flow and intent of the code for less experienced programmers, but can prove invaluable when returning to your own code months down the line. There is not a required format for comments, but the following are recommended.

                            * Encodes string for use in XML
                            * @param       string  $str    Input string
                            * @return      string


Constants should always be fully uppercase.

true, false, and null

true, false, and null must always be fully lowercase.

Logical operators

Use || for "or". Use && for "and" and don't use spaces around ! operator.

Comparing return values and typecasting

Some PHP functions return FALSE on failure, but may also have a valid return value of “” or 0, which would evaluate to FALSE in loose comparisons. Be explicit by comparing the variable type when using these return values in conditionals to ensure the return value is indeed what you expect, and not a value that has an equivalent loose-type evaluation.

Use the same stringency in returning and checking your own variables. Use === and !== as necessary.

Typecasting has a slightly different effect which may be desirable. When casting a variable as a string, for instance, NULL and boolean FALSE variables become empty strings, 0 (and other numbers) become strings of digits, and boolean TRUE becomes “1”.

Debugging code

Do not leave debugging code in your submissions, even when commented out. Things such as var_dump(), print_r() should not be included in your code unless it serves a specific purpose other than debugging.

Whitespace in files

No whitespace can precede the opening PHP tag or follow the closing PHP tag. Output is buffered, so whitespace in your files can cause output to begin before Appskull outputs its content, leading to errors and an inability for Appskull to send proper headers.


Use spaces for whitespace in your code, not tabs.

Code indenting

Use 4 spaces for indentation.

Class and method body braces

Opening and closing braces should be in same level of indentation.

                           class Hello


                           function hello()


Conditional statement block braces

Use allman style indenting for opening and closing braces.

                           if () {

                           } else {


One statement per line

Never combine statements on one line.


Always use single quoted strings.

Copyright © Nudasoft.