Given yesterday’s news that Honda can now connect thoughts to robotic actuators, we have been given permission to talk about the Solar PHP implementation of that interface: Solar_Mind_Read.

class Solar_Mind_Read extends Solar_Base {

    protected $_Solar_Mind_Read = array(
        'mind' => null,

    protected $_mind;

    public function __construct($config = null)

        $this->_mind = Solar::dependency(

    public function fetchIntent($search)
        return $this->_mind->recall($search);

    public function doWhatIMean($subject, $callback)
        $intent = $this->fetchIntent($subject);
        return call_user_func($callback, $intent);

    public function fetchPhpCode($task)
        throw $this->_exception('ERR_NOT_IMPLEMENTED', array(
            'task' => $task,

As you can see, we leverage Solar’s base class and inherited configuration, along with its existing dependency injection functionality, to receive an existing Honda “thought” object at construction time. We can then see what the user’s intent is given a particular subject using the fetchIntent() method.

Even better, we can pass a callback to the doWhatIMean() method. This means that the user will always get what he wants, not merely what he asks for.

Finally, as a developer tool, the fetchPhpCode() method will take a task description and generate PHP code for it. We are waiting on a related patch to the PHP RunKit extension for this to be fully implemented. In the mean time, the automatic exception system finds the right exception class and throws it, with localized translation, and information about the task.

Once Solar_Mind_Read is complete, we believe we will be able to move on to Solar_Mind_Write. Together, these tools should help the developer with convincing his clients that what they really need is something that’s easier to implement, and then with actually implementing it.

Thanks for your attention; we hope this April Fool’s Day article piques your interest in the power of the Solar Framework for PHP 5. Many thanks to Clay Loveless for the subject idea. 🙂

Are you stuck with a legacy PHP application? You should buy my book because it gives you a step-by-step guide to improving your codebase, all while keeping it running the whole time.

5 thoughts on “Solar_Mind_Read

  1. Ohhh, yeah!!

    I was waiting for this for a long time now. Thank you.

    I wish you could add one more functinality to Solar…


    With that I could even start using frameworks!

  2. Help!

    I’ve accidentally passed “2009” to the back() method in Solar_Time_Travel. Now, when I try to pass $original_year I receive an exception with an error code of ERR_NOT_YET_IMPLEMENTED. Do you have a spare instance of Solar_Flux_Capacitor?

  3. @Jeff Moore: We’re sending a troubleshooter from the future to terminate the instance. He looks like Arnold Schwarzenegger; just do what he says.

  4. Is it bad, that I run the code and it came back blank? Then with the second execution, it came back, “Thoughts not found.”

    Should I curl up and cry, because I think I’m going to do that now.

Leave a Reply

Your email address will not be published. Required fields are marked *