Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Custom panel for the CakePHP DebugKit allowing for interactive sessions with your app
PHP
branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
controllers
models
tests/cases/models
vendors
views
webroot/img
README
interactive_app_controller.php
interactive_app_model.php

README

/*
 * Interactive panel for the CakePHP DebugKit
 * Copyright (c) 2009 Matt Curry
 * www.PseudoCoder.com
 * http://github.com/mcurry/interactive
 *
 * @author      Matt Curry <matt@pseudocoder.com>
 * @author      Sandu Lungu <sandu@lungu.info>
 * @license     MIT
 *
 */

This version of the plugin is compatible with CakePHP 1.3 and the latest DebugKit
 
/* About */
This plugin adds easy interactions with your CakePHP app using the console or through a custom panel for the CakePHP DebugKit.  
It handles simple PHP commands, SQL queries and PHP using your Cake objects.

/* Examples */
10 % 4 (returns 2)
is_array(49) (returns false)
SELECT id FROM users WHERE email = 'test@test.com' (retuns the id of the matching record)
User::findByEmail('test@test.com') (returns the entire matching user record)

/* Power Usage */
When using in the DebugKit panel you can stack commands, just make sure to end each with a ";" as you would in your code.

If you're having trouble getting results for a particular command and can't figure out why try turning on debug as the first command:
Configure::write('debug', 2);
User::findByEmail('test@test.com');
Facebook.Page::findByEmail('test@test.com'); // here we use a plugin

/* Warning */
There isn't any sort of error detection or validation on the input.  Also there isn't any pagination for long result sets.  If you enter in a query that returns a million records, you're going to get a million records.

You can't declare a variable and use it across commands. For example this doesn't work:
$i = 10;
$i ++;

/* Instructions */
1) Download the plugin to /app/plugin/interactive

/* Console Instructions */
1) Run the cake console passing the "interactive" shell
   from /app: ../cake/console/cake interactive

2) Enter commands as needed.  Enter 'Q' to exit.  

3) You can also commands as parameters.  The interactive shell will run the command and exit
   ../cake/console/cake interactive Post::find('first')

/* DebugKit Instructions (trunk) */
1) Include the panel:
   $components = array('DebugKit.Toolbar' => array('panels' => array('Interactive.interactive'));
Something went wrong with that request. Please try again.