HTTPS SSH

CONTENTS OF THIS FILE

  • About phpRAD
  • Configuration and features
  • Folders
  • Adding a new action
  • Adding a new bundle
  • Executing an action
  • Executing a bundle
  • Examples

ABOUT PHPRAD

phpRAD is a PHP-based MVC framework to build general purpose applications. Its architecture makes possible for a team to work in isolated layers to optimize development times.

CONFIGURATION AND FEATURES

Configuration is under config/ folder. You can adapt this configuration to your needs, but remember that certain keys could affect the application behavior. Classes are loaded automatically thanks to Autoloader.php.

FOLDERS

  • classes: Classes of the framework.
  • classes/mvc: The funny stuff.
    • controller: Generic and specific controllers (called 'actions' or 'bundles').
      • actions: Custom controllers.
      • bundles: Batch execution of individual controllers.
      • ext: Extended common functionality for custom usage.
    • model: Generic and specific models. Specific models MUST be named the same as the controller they belong to.
      • ext: Extended common functionality for custom usage
    • view: View templates (usually HTML). Templates MUST be named the same as the controller they belong to.
  • config: Autoloaded configuration files.
  • resources: Dynamical generated files.
    • css: Autoloaded CSS files.
    • fonts: Fonts.
    • img: Static images.
    • js: Autoloaded JS files.
    • log: Log files.
    • temp: Temporary files.
    • templates: Generic templates.
    • views_output: Output files generated by the actions and bundles.
  • src: Application specific code.
  • vendor: External components.

DEPENDENCIES

ADDING A NEW ACTION

Adding a new action is very simple. For this example, we are creating an action called Athenea. Follow these steps:

  1. Create a controller in src/controller/actions/AtheneaController.class.php. Controllers MUST inherit from BaseController and implement IController.
  2. If data interaction needed, create a model in src/model/AtheneaModel.class.php. Models MUST inherit from BaseModel and implement IModel.
  3. Create a view in src/view/AtheneaView.tpl. Your view MUST be Smarty based.

ADDING A NEW BUNDLE

Adding a new bundle is very simple. For this example, we are creating an action called Ulysses. Follow these steps:

  1. Create a controller in src/controller/bundles/UlyssesController.class.php. Controllers MUST inherit from BaseController and implement IController.
  2. Create a view in src/view/UlyssesView.tpl. Your view MUST be Smarty based.

EXECUTING AN ACTION

CLI: php -f index.php action=Athenea [param1=value1 param2=value2 ...] HTTP: http://APPURL/?action=Athenea&param1=value1&param2=value2

EXECUTING A BUNDLE

CLI: php -f index.php bundle=Athenea [param1=value1 param2=value2 ...] HTTP: http://APPURL/?bundle=Athenea&param1=value1&param2=value2

EXAMPLES

I have prepared some examples to test the framework easily:

CLI: 1. CSV handler: php -f index.php action=Csv csv=[path to a valid csv file] 2. MySQL handler: php -f index.php action=Mysql (if the connection fails, change the parameters in the config.json file) 3. Redis handler: php -f index.php action=Redis (if the connection fails, change the parameters in the config.json file) 4. Bundle: php -f index.php bundle=Bundle csv=[path to a valid csv file]

HTTP: 1. CSV handler: http://APPURL/?action=CsvForm 2. MySQL handler: http://APPURL/?action=Mysql (if the connection fails, change the parameters in the config.json file) 3. Redis handler: http://APPURL/?action=Redisl (if the connection fails, change the parameters in the config.json file) 4. Bundle: http://APPURL/?bundle=BundleForm * APPURL is the host where your instance of phpRAD is installed