Table of Contents

Coding Standards

PHP

VuFind® currently uses the PSR-12 standard for its PHP code; versions 8.x and earlier were developed using the similar but now outdated PEAR Coding Standards. Several additional recommendations are enforced using the php-cs-fixer tool. For help with standards compliance, see the recommended tools page.

Javascript

ESLint style enforcement is in effect. It uses ESLint recommended rules with a few extra rules. For more information, see this pull request.

Templates

Templates are a difficult mix of conditional PHP, HTML, and inline JS. Here's a few guidelines to help write clearer templates.

Many of these items and more are enforced and automatically corrected with PHP-CS-fixer.

CSS

No strict coding practices enforced, although the Code Guide by Bootstrap creator Mark Otto is a recommended read.

Editor Config

# editorconfig.org

root = true

[*]
charset = utf-8
end_of_line = lf
indent_size = 2
indent_style = space
insert_final_newline = true
trim_trailing_whitespace = true

[*.php]
indent_size = 4