Systems Framework


The subject of this presentation is to illustrate the
     objective and advantages of the Object
 Orientated design and central logic of the PHP
     config and helper classes in report and
      billing/commissions web application.
Basic Principle
●   The basic programming logic places all code
    for connecting to the database and/or LDAP
    into each script created via standard PHP db
    functions.
●   Most code uses certain functionality that is
    repeated per script
Improving the logic
    I have designed and created a custom framework
    and set of classes and central config directive to
    improve on:
●   Avoid duplicating code and improve on time
    required to update code
●   Keep sensitive data like database login data away
    from the main scripts
●   Add debug views to any script by simply
    activating this display as required
Structure
●   The structure of the framework consist of the main folder :
    PHP which then uses the folders:
    –   Configs: this contains the configuration file where db connections
        is setup. LDAP connections is setup, Error reporting is setup,
        Email functionality is setup,loading of required classes is defined.
        It also makes use of some PHPLib and PEAR classes/functions.
    –   Classes: the classes folder contains all the bussiness logic
        classes and is activated from the config.php file in Configs folder
    –   Templates: page templates is defined here
    –   Scripts: 3rd party support : like JQuery
Structure – directory view
●   The folder structure therefore looks like this:
    -root -
         – PHP
          –   Configs
          –   Classes
          –   Templates
          –   scripts
Script files
●   Each php file in the main app then simply includes the config file and switches on the desired
    connections to the database and/or LDAP and the classes required by the following (simple
    example) line:
    –   Require “configs.php”;
        $configs = array { DEBUG => 1 //to enable debug output,
                            CLASSES => (“DB”,”Accounts”,”Reporting”) }

●
    This allows one to use an already connected db for example and using the
    db classes then for queries. This makes changes to the db connection easier
    as only the config file included needs to be changed and not every single
    php file in the project(s) that needs to be changed
●
    Classes can also be changed and improved without having to change and
    update every single main php script in the project/application.
●   The debug option makes finding errors in queries easier and locating
    possible errors in classes (calling functions in each class is defined by the
    query debug output on screen)

Systems framework

  • 1.
    Systems Framework The subjectof this presentation is to illustrate the objective and advantages of the Object Orientated design and central logic of the PHP config and helper classes in report and billing/commissions web application.
  • 2.
    Basic Principle ● The basic programming logic places all code for connecting to the database and/or LDAP into each script created via standard PHP db functions. ● Most code uses certain functionality that is repeated per script
  • 3.
    Improving the logic I have designed and created a custom framework and set of classes and central config directive to improve on: ● Avoid duplicating code and improve on time required to update code ● Keep sensitive data like database login data away from the main scripts ● Add debug views to any script by simply activating this display as required
  • 4.
    Structure ● The structure of the framework consist of the main folder : PHP which then uses the folders: – Configs: this contains the configuration file where db connections is setup. LDAP connections is setup, Error reporting is setup, Email functionality is setup,loading of required classes is defined. It also makes use of some PHPLib and PEAR classes/functions. – Classes: the classes folder contains all the bussiness logic classes and is activated from the config.php file in Configs folder – Templates: page templates is defined here – Scripts: 3rd party support : like JQuery
  • 5.
    Structure – directoryview ● The folder structure therefore looks like this: -root - – PHP – Configs – Classes – Templates – scripts
  • 6.
    Script files ● Each php file in the main app then simply includes the config file and switches on the desired connections to the database and/or LDAP and the classes required by the following (simple example) line: – Require “configs.php”; $configs = array { DEBUG => 1 //to enable debug output, CLASSES => (“DB”,”Accounts”,”Reporting”) } ● This allows one to use an already connected db for example and using the db classes then for queries. This makes changes to the db connection easier as only the config file included needs to be changed and not every single php file in the project(s) that needs to be changed ● Classes can also be changed and improved without having to change and update every single main php script in the project/application. ● The debug option makes finding errors in queries easier and locating possible errors in classes (calling functions in each class is defined by the query debug output on screen)