-
Notifications
You must be signed in to change notification settings - Fork 5
File Structure
- modules
- firephp
- classes
- controller
- template
- firephp.php
- firephp.php
- template
- database
- mysql.php
- pdo.php
- firephp
- log
- console.php
- file.php
- fire.php
- profiler.php
- log
- vendor
- firephp.php
- fire.php
- controller
- config
- firephp.php
- vendor
- FirePHP
- FirePHP.class.php
- FirePHP
- README
- example-bootstrap.php
- classes
- firephp
The KO3 FirePHP module is stored under the modules directory in Kohana 3. Under there we have classes, config, vendor, a sample bootstrap.php file and the README.
Various configuration options are stored in config, but don’t make changes here directly. Just copy it to the application/config and make your changes there.
The actual FirePHP library is stored outside the classes folder in a folder called vendor. 3rd party class are unaware of HMVC file structures and class naming conventions. So we keep it separate from actual Kohana aware classes that do follow proper KO3 naming conventions. No need to rename it either, just drop in the latest version and it should work…
The FirePHP class is then extended as a KO3 aware class and stored in the vendor sub-directory of classes. Additional functionality is added here as well. Normally this would be kept in the kohana directory, but since this is not an official module, using kohana would be inappropriate.
Also under classes we have the controller directory which contain extended version of the standard controller and template controller used to output Profiler’s data to the FireBug Console. Extend your application’s controllers from these if you wish to just debug/profile that controller, and not the entire application.
Under database are extened versions of pdo and mysql databases that pass the actual query data to the FirePHP class so that it can display it to the console in table format.
The firephp sub-directory contains a log directory which has an extended version of the File Log Writer that allows for excluding specific types from being logged to file. This is handy when you want to keep your log file clean of FirePHP debug messages. You can also configure the output format. Also added is console.php which is a Log Writer that writes all Kohana::$log messages to the FireBug Console. It can accept various FirePHP types to format the console output as desired.
The fire.php file is a helper class that contains a series of static functions that calls the various FirePHP methods from the singleton instance of FirePHP_Profiler…
So basically you can do this:
Fire::log('Hi Mom!'); Fire::group('Message to Mom')->log('Helllo, Mother')->groupEnd();
compared to say, this…
FirePHP_Profiler::instance()->log('Hi Mom!'); FirePHP_Profiler::instance()->group('Message to Mom')->log('Hello, Mother')->groupEnd();
or this…
Kohana::$log('FirePHP::LOG', 'Hi Mom!')->write(); Kohana::$log('FirePHP::GROUP_START', 'Message to Mom'); Kohana::$log('FirePHP::LOG', 'Hello, Mother'); Kohana::$log('FirePHP::GROUP_END', '')->write();
However the latter will add a nice time stamp to the output.
Fire and FirePHP_Profiler are wrapper classes so that anyone can easily overwrite them higher up in the HMVC file structure to do whatever they so choose… That is the beauty of HMVC and KO3… gotta love it!