Banshee
the secure PHP framework

Internal structure

Banshee uses the Model-View-Controller (MVC) architecture. For every page a view is required, unless you disable the output library in the controller. The controller and model are both optional.

A typical Banshee root directory consists mainly of directories. Below, you find a list of typical Banshee directories and their purpose.

  • controllers: contains the controller PHP scripts.
  • database: contains database operation scripts and a MySQL database dump used to initialize the MySQL database.
  • extra: all extra files needed for the website.
  • libraries: contains all the Banshee libraries and database drivers.
  • logfiles: contains Banshee logfiles and can also be used to store the webserver logfiles.
  • models: contains the model PHP scripts.
  • public: the webroot directory. Contains all the files which can be requested directly via a browser, like images, javascripts and CSS files.
  • settings: contains configurations files for Banshee framework.
  • templates: contains template files (PHP scripts and XSLT sheets), which can be used for new pages.
  • views: contains XSLT sheets, which are used as the view.

Available objects

In every page (controller), the following objects are available: $this->db, $this->settings, $this->session, $this->page, $this->user and $this->view.

  • db: Can be used to access the MySQL database. This object is an instance of the class 'MySQLi_connection' in libraries/core/databases/mysqli_connection.php.
  • settings: Read and write settings stored in the settings database table. This object is an instance of the class 'settings' in libraries/core/settings.php.
  • session: Contains information about the current session. As this is a purely internal library, you will probably not need to use this library yourself.
  • page: Contains information about the current page request. This object is an instance of the class 'page' in libraries/core/page.php.
  • user: Contains information about the current user (visitor). This object is an instance of the class 'user' in libraries/core/user.php.
  • view: Used to create the output. In Banshee, the view is done via XSLT. A controller builds up a XML document via this object. Banshee will transform this XML and the XSLT view into the final output, which is send to the browser. This object is an instance of the class 'view in libraries/core/view.php.