9 Feb
My Next Foolish Project: A console for CakePHP
On the CakePHP mailing list, somebody familiar with Ruby on Rails’ console functionality asked “why isn’t there one of these in Cake?”. I, of course, jumped right in and said “such a thing does not exist in PHP.” Nate, of course, quickly corrected me and pointed out that PHP has an interactive mode. Which lets you do some stuff quickly for testing purposes, but this is not enough. So I foolishly volunteered to work on a console. Like I’m not busy enough.
So I got to thinking about how to do this. On the surface, it seems the easiest way to do this is to write a PHP script that takes entries on the command line, run the input through an ‘eval’ statement. Sounds easy enough, and I could write that in a hurry. I think the trickiness comes in figuring out how to hook it into CakePHP so that you can access Models that already exist. I guess this will be something that will bother me while I’m at the conference on Monday and Tuesday. I’ll be sure to mention it during my talk.

Posted by hydra12 on 09.02.07 at 11:04 pm
I’m not familiar with the console in ruby on rails, but have you looked at the php_shell in pear? It might be a good place to start.
Posted by Chris Hartjes on 09.02.07 at 11:04 pm
@hydra12: I’m trying to find a solution that doesn’t involve PEAR or any other external libraries. I was hacking away at it on my flight home from Vancouver…and didn’t accomplish much. I must dig into Cake in more detail to figure things out. The biggest problem is how to properly trap fatal errors…