cakephp php framework komodo

How to setup and use CakePHP with Komodo


How do I setup Komodo to best work with my CakePHP applications?


CakePHP relies on many applications: a web server (like Apache), a database (like MySQL) and PHP 4.3.2 or greater, so ensure you follow the necessary instructions for setting this up for your operating system, see the CakePHP installation section for details:

I will not cover the setting up of a CakePHP application, but expect the user has an existing CakePHP application they want to work on using Komodo.

Configuring Komodo to work with CakePHP

  • PHP interpreter
    Komodo needs to know where the PHP interpreter is, this is so Komodo can provide PHP specific functionality such as Syntax Checking, Debugging and Code Completion.
    • Go to the Komodo preferences, select the "Languages->PHP" category and check/set the PHP interpreter to point to the PHP executable you have installed.
  • PHP Frameworks
    Komodo needs to know where your third-party PHP code is located, so that it can assist in providing adequate PHP code completions, calltips and code intelligence benefits. Generally for applications that install as part of the PHP standard library location or are added to the php interpreter's php.ini file, this is not necessary, but for frameworks that are configured through the web platform (i.e. http.conf) this step is necessary.
    • Go to the Komodo preferences, select the "Languages->PHP" category and in the "PHP Directories" area, select the "Add..." button to browse to where the core CakePHP libraries are installed, i.e. "/wwwroot/cake/cake" on my linux machine.
  • Setup your project
    Komodo provides help for managing your application development through the use of projects. Projects let you view the application layout, edit and manage files/folders as well as providing command, macro and snippet tools.
    • Use the menu "File->New->Project" to start creating a new project. Save the project to the base directory where your CakePHP application resides, i.e. "/wwwroot/cake/app/App1.kpf"
    • Once saved, the project itself and the list of files/folders should appear in Komodo's project pane, where you sort, expand/collapse and click on to open for editing
    • As you edit your CakePHP application files, you should notice completions for CakePHP functions and classes, try this for an example:
      $session = new CakeSession();

      You should have calltip/completions when you type the open paren "new CakeSession(", when you type "$s" and when you type the "session->".

  • Bake run command
    Bake is a command line PHP script that will automagically generate a model, controller, and views based on the design of your database.
    • On your application project, right-click and select menu "Add->New Command...", call it "Bake", set the "Start in:" field to be "%p" which means the active project and then use the command text below:
    • For the command, use
      %(php) /wwwroot/cake/cake/scripts/bake.php

      , or if the script is provided as a windows batch file, you can simply just specifiy this file as

    • Bake runs interactively, so you can either run it through Komodo Command Output Tab (the default) or choose to run it in it's own separate console window, whichever is your preference.

Other Komodo/CakePHP resources
Komodo Macros for inserting CakePHP template hints

Advantages of using Komodo IDE
The advantages of using Komodo are many (just note that I am of course somewhat biased, heh).

  • Komodo comes already prepared with most things you need for PHP development, such as integrated source code control and code intelligence helpers, so you don't need to play around with specific plugins or download a special build to get up and running.
  • Komodo provides code completions and calltips easily, simply define what PHP frameworks you need and and it's done, calltips and completions appear immediately afterwards.
  • Komodo IDE provides debugging tools to help analyse your code and data in real time.
  • Komodo IDE provides additional web tools to help with client/server development, such as the HTTP Inspector and the JavaScript debugger.
  • Most of Komodo is open source, so you can dig into the code and contribute if you feel like it:

Hope that helps.