Skip to content

Latest commit

 

History

History
84 lines (73 loc) · 3.43 KB

File metadata and controls

84 lines (73 loc) · 3.43 KB

CBER Web Development Notes

This repository was set up to collect important general information and issues related to the web development work at the Ball State University Center for Business and Economic Research.

If there are any issues that apply to a large number of CBER's websites or none of them in particular, they should go here.

Services

All websites need the following:

Frameworks

PHP standards

  • CakePHP code sniffer standards (extension of PSR-12)
  • Test with PHP_CodeSniffer
  • Use camelCaps for variable names instead of underscored_names
  • Avoid prefixing method names with underscores
  • Store sensitive information (and information that changes based on environment) in .env or config/app_local.php files that are not committed
  • Indent with four spaces
  • Avoid using any deprecated code from libraries (so migrating to the next major version will be easier)

HTML standards

Template file standards

  • Use short echo tags when not in a multiple-line block of code, e.g.

     <a href="<?= $url ?>">
         <?= $label ?>
     </a>

    or

     <a href="http://example.com">
         <?php
             $foo = getFoo();
             $bar = getBar($foo);
             echo ucwords($bar);
         ?>
     </a>
  • Declare $this and other variables in opening doc comment, e.g.

    <?php
        /**
         * @var \App\View\AppView $this
         * @var \App\Model\Entity\Survey $survey
         * @var \App\Model\Entity\Community $community
         */
    ?>

    Some of these can be automatically added by dereuromark/cakephp-ide-helper

CSS (and preprocessor) standards

JavaScript standards

Consideration for future standards