tags:

views:

201

answers:

4

For those that are familiar with Rails, you can do

script/console

in the root of an app, and you'll get an interactive shell that has all your app code loaded, where you can enter Ruby expressions, and their results will get printed on the next line.

Is there something like that in Cakephp, or is console just for scripts? If not, could you theoretically build such a thing on top of the console? I'm not sure, because I'm not too familiar with PHP.

A: 

Yes it is, http://book.cakephp.org/view/108/The-CakePHP-Console

Karl Roos
I'm pretty sure that page doesn't describe something interactive: "If you’ve ever needed access to your CakePHP MVC classes in a cron job or other command-line script, this section is for you."
allyourcode
+2  A: 

There is not a peer to the rails console. Cake does have the idea of shells, which can be used for writing scripts, really more a peer to the runner in rails than to the console. One example of a CakePHP shell is the executable bake, which does much of the auto-generation.

Rob Di Marco
+4  A: 

This is mine. I'm not familiar w/ the Rails version, but I think it's pretty similar. http://github.com/mcurry/interactive

Matt Curry
+1  A: 

I believe running script/console just launches irb and bootstraps in your Rails application code.

PHP5 now has an interactive shell (php -a) so maybe we might see something like this in the future.

I am not sure how well PHP5's native interactive shell stacks up against PHP_Shell available from PEAR.

deizel