Application Structure

By application, we mean a collection of files and directories organized in a specific structure.

By the application core, we mean a group of basic components called BFF, which stands for Best Friends Forever.

Let's take a look at the directory structure of the application:

  • app - application classes inherited in order to add additional application logic or modify the behavior of core components
  • bff - application core (base classes, modules, components...)
    • base - base components that can be overridden by external classes later
    • cache - classes implementing caching functionality
    • captcha - captcha
    • db - database components
      • comments - component for working with comments
      • dynprops - component for working with dynamic properties
      • migrations - migration class templates
      • nestedsets - component for working with nested sets structure in tables
      • publicator - Publicator component, an alternative to the WYSIWYG editor
      • sphinx - component for working with Sphinx
      • tags - component for working with tags
    • extend - base classes for application extensions
    • external - external components used in the core/application
      • hybridauth - library implementing API for social network authorization
      • jevix - HTML/text parser that controls allowed tags and attributes and provides minimal necessary typographic formatting
      • minifier - component responsible for minimizing static files (css, js)
      • parsedown - component implementing support for Markdown markup
      • phpmailer - library for sending emails through sendmail or SMTP
      • sphinx - API for working with the Sphinx search engine
    • files - file handling components
    • fonts - font files used in the core/application
    • gettext - components for working with gettext extension
    • img - image handling components - upload, cropping
    • logs - components for working with logs
    • modules - modules of the core
    • session - components for working with sessions and forums
    • tpl - core components responsible for rendering forms and lists in the admin panel
    • utils - additional utilities
  • config - application configuration files
    • db.tables.php - common application tables
    • sys.php - system settings file (project domain, database access, etc.)
  • custom - directory for storing modified files of extensions
  • files - system static files
  • install - files required for application installation: instructions, database dump install.sql
  • modules - application modules
  • plugins - application plugins
  • public_html - application's public directory (files accessible by direct link)
    • css - css files of the application
    • custom - modified static files of the application
    • files - uploaded static files
      • bnnrs - banners
      • extensions - loaded extension files (accessible by direct link)
      • im - internal mail attachment files
      • images - images
      • min - minimized static files of the application and extensions
      • pages - static pages
    • img - application images
      • admin - images used in the admin panel of the application
    • js - javascript files of the application
    • plugins - static files of the plugins (css, js, img)
    • themes - static files of the themes (css, js, img)
  • themes - application themes
  • tpl - application templates (root level)
    • admin - templates for the admin panel of the application
  • vendor - directory for storing external libraries installed via Composer

Basic Classes and Components of the Application

bff - Application class (intro.md)

Cache - Base class for caching operations

Comments - Component for working with comments

Component - Base component

config - Component for working with settings

Database - Class for working with database

Dynprops - Component for dynamic properties

Errors - Class for working with errors

Files - Set of general-purpose functions for working with files

func - Set of common helper functions

HTML - Auxiliary class for HTML methods

js - Auxiliary class for working with JavaScript code

Input - Validation class for incoming data (GET, POST, COOKIE ...)

Locale - Class for working with localization

CMail - Class responsible for sending mail (based on PHPMailer)

Model - Model class

Module - Base component for module

Pagination - Component for generating "pagination navigation"

Publicator - Publicator component

Request - Auxiliary class for working with request parameters

Security - Class for working with session and implementing security mechanisms

Tags - Component for working with tags

TextParser - Auxiliary class for text processing methods

tpl - Auxiliary methods for data formatting in templates

User - Class for working with authorized user data

View - Class for working with template display templates