PHP Development Standards

We use CodeIgniter, a PHP MVC framework.

(http://www.beingidea.info/learn-codeigniter-tutorial-for-beginners)

  • The Model represents your data structures. Typically, your model classes will contain functions that help you retrieve, insert and update information in your database.
  • The View is information that is being presented to a user. A View will normally be a web page, but in CodeIgniter, a view can also be a page fragment like a header or footer. It can also be an RSS page, or any other type of “page”.
  • The Controller serves as an intermediary between the Model, the View, and any other resources needed to process the HTTP request and generate a web page.

On UITS servers, the system part is separated and is located in the shared directory.

Development standards

  • External libraries should be installed in the vendor directory of the shared directory (using Composer), and shouldn’t be committed and pushed to the repository
  • Don’t use $_GET, $_POST, $_PUT, etc. directly. For security purposes:
    • Should use CodeIgniter methods:
      • $this->input->post()
      • $this->input->get()
      • $this->input->cookie()
      • $this->input->server()
    • Also filter_input(). See the discussion
  • In the MVC model, use a view to present data if there is. Don’t squeeze them together for example in a controller
  • dwsync.xml created by Dreamweaver should not be committed/pushed (source of conflicts in remote branches)
    • In .gitignore in root directory, add [_]notes/