PHP Classes

Ordit Kohana ORM Audit: Track calls to Kohana framework ORM classes

Recommend this page to a friend!
  Info   Screenshots Screenshots   View files View files (21)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog    
Last Updated Ratings Unique User Downloads Download Rankings
2024-01-09 (4 days ago) RSS 2.0 feedNot yet rated by the usersTotal: 140 All time: 9,184 This week: 257Up
Version Licenses PHP version Categories
kohana-orm-audit 1.0Artistic License, F...5.3PHP 5, Databases, Logging, Design Pat...
Description 

Author

This package can track calls to Kohana framework ORM classes.

It provides a class that extends Kohana ORM base class to track calls to CRUD functions and log details about each call in a database.

The package also provides class to view the log CRUD function calls in a Web page.

Innovation Award
PHP Programming Innovation award nominee
July 2013
Number 10
Kohana is a PHP framework that provides Object-Relational Mapping (ORM) classes. Applications may use those classes to store and retrieve information from a database and access it using objects of the classes.

When you want to debug a database application, it is useful to see what types of databases accesses the application is doing in the context of the objects that the application uses.

This package can provide means to log accesses to Kohana framework ORM classes in a way that it is useful to help debugging the application.

Manuel Lemos
Picture of Stefan Jibrail Froelich
  Performance   Level  
Name: Stefan Jibrail Froelich <contact>
Classes: 6 packages by
Country: United States United States
Innovation award
Innovation award
Nominee: 3x

Details

# Ordit Ordit is a Kohana 3.x module that adds automatic auditing to the Official ORM module. Ordit is a transparent extension that audits all CUD actions on your objects. It includes a Log Viewer to view all Audit logs. ## Getting started Before we use Ordit, we must enable the modules required Kohana::modules(array( ... 'database' => MODPATH.'database', 'orm' => MODPATH.'orm', 'ordit' => MODPATH.'ordit', ... )); [!!] Ordit requires the ORM module (plus its dependencies) to work. ### Setting up the database You need to create a table in your database to hold all your logs. A script is included in the module named `ordit_logs.sql` The script is for a mysql database running the InnoDB engine. The table is configured as follows: Table Name :: `ordit_logs` Columns :: `id` INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY `model` CHAR(50) NOT NULL, `action` CHAR(7) NOT NULL, `values` TEXT NOT NULL, `user` CHAR(50) NOT NULL, `timestamp_created` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, ### Overriding the Ordit::get_username Method In order to provide the current logged in user's username for auditing, create a class in your classes folder named `Ordit` that extends the `Model_Ordit` class. Then override the `get_username` method to return the current logged in user's username. The example below uses the default `Auth` module. class Ordit extends Model_Ordit { protected function get_username() { return Auth::instance()->get_user()->username; } } ### Auditing Your Models To enable auditing of your ORM models, you simple extend `Ordit`. class Model_Model extends Ordit { ... } Any CREATE, UPDATE and DELETE actions are automatically and transparently logged. You don't have to do anything else. ### Viewing Your Logs The module includes a log viewer. You can view logs at (http://site_root/ordit) [!!]The log viewer was modified from [Kohana Log Viewer](https://github.com/ajaxray/Kohana-Log-Viewer) viewer. ## TODO ### Log Changes to Related Modules Currently, changes to related modules are logged as an empty array. ##Improve Viewer Add pagination to the log results Add ability to search by currently `undefined parameters`

Screenshots  
  • Log-Viewer.png
  Files folder image Files  
File Role Description
Files folder imageassets (3 files)
Files folder imageclasses (1 file, 2 directories)
Files folder imageconfig (1 file)
Files folder imageguide (1 directory)
Files folder imageviews (1 directory)
Accessible without login Plain text file init.php Example Class source
Accessible without login Plain text file ordit_logs.sql Data Auxiliary data
Accessible without login Plain text file readme.md Data Auxiliary data

  Files folder image Files  /  assets  
File Role Description
  Accessible without login Plain text file bootstrap.min.css Data Auxiliary data
  Accessible without login Plain text file jquery.js Data Auxiliary data
  Accessible without login Plain text file style.css Data Auxiliary data

  Files folder image Files  /  classes  
File Role Description
Files folder imageController (1 file)
Files folder imageModel (1 file, 1 directory)
  Plain text file Ordit.php Class Class source

  Files folder image Files  /  classes  /  Controller  
File Role Description
  Plain text file Ordit.php Class Class source

  Files folder image Files  /  classes  /  Model  
File Role Description
Files folder imageOrdit (2 files)
  Plain text file Ordit.php Class Class source

  Files folder image Files  /  classes  /  Model  /  Ordit  
File Role Description
  Plain text file Log.php Class Class source
  Plain text file Ordit.php Class Class source

  Files folder image Files  /  config  
File Role Description
  Accessible without login Plain text file userguide.php Conf. Configuration script

  Files folder image Files  /  guide  
File Role Description
Files folder imageordit (5 files)

  Files folder image Files  /  guide  /  ordit  
File Role Description
  Accessible without login Plain text file index.md Doc. Documentation
  Accessible without login Plain text file installation.md Doc. Documentation
  Accessible without login Plain text file menu.md Doc. Documentation
  Accessible without login Plain text file todo.md Doc. Documentation
  Accessible without login Plain text file usage.md Doc. Documentation

  Files folder image Files  /  views  
File Role Description
Files folder imageordit (4 files)

  Files folder image Files  /  views  /  ordit  
File Role Description
  Accessible without login Plain text file daylist.php Output Sample output
  Accessible without login Plain text file layout.php Output Sample output
  Accessible without login Plain text file monthlist.php Output Sample output
  Accessible without login Plain text file report.php Output Sample output

 Version Control Unique User Downloads Download Rankings  
 95%
Total:140
This week:0
All time:9,184
This week:257Up