How to set up a configuration file for the Stanford Web Application Toolkit

From Web Services Wiki

Jump to: navigation, search


You want to create or modify a configuration file for SWAT.


The toolkit accepts a YAML-formatted configuration file with the following attributes:

# StanfordApp YAML configuration file
  # Basic application info
  name: My Application
  admin email:
  admin name: Admin Name
  base url:
  base directory: /afs/
  # Login credentials
  name: db_name
  username: db_username
  password: db_password
  # Use encryption for all database operations?  Enter 'yes' or 'no'
  # yes => All database traffic is encrypted, slower but more secure.
  # no => Just the login credentials are encrypted, faster, most commonly used.
  use encryption: no
  # Use MySQL-based sessions?  Highly recommended if using sessions and MySQL access is enabled.  Enter 'yes' or 'no'
  # The toolkit will create a table called "php_sessions" for you if it doesn't already exist.
  use mysql sessions: yes
  # Undo magic quotes?  Recommended setting is 'yes.'
  undo magic quotes: yes
  # Logging mode: available options are production, development, or debugging
  # production => recommended for live sites; does not display errors, warnings, or notices to the browser
  # development => recommended for sites currently being developed; shows all errors and warnings but not notices
  # debugging => useful for debugging; shows all errors, warnings, and notices
  logging mode: development

Simply create the configuration file and send its path as an argument to StanfordApp.

// Include StanfordApp
// Create a new StanfordApp with a configuration file
$app = new StanfordApp("/path/to/config.yaml");
Personal tools