in Cakephp tips minutes

Some CakePHP and Composer Tips

One of the nice features of CakePHP 3 is it uses Composer to handle the various software that Cake is built on, including its own modules. Composer is a dependency manager for PHP that’s become the de facto way of managing libraries in PHP projects. If you’re coming from the Javascript world, it’s analogous to NPM or Bower.

Few commands to know:

composer update  – run inside the main app folder this checks for updates

How does it know what to update? It looks in the composer.json  file:

    "name": "cakephp/app",
    "description": "CakePHP skeleton app",
    "homepage": "",
    "type": "project",
    "license": "MIT",
    "require": {
        "php": ">=5.4.16",
        "cakephp/cakephp": "3.0.*-dev",
        "mobiledetect/mobiledetectlib": "2.*",
        "cakephp/migrations": "dev-master",
        "cakephp/plugin-installer": "*",
        "intervention/image": "dev-master",
        "erusev/parsedown": "dev-master"
    "require-dev": {
        "d11wtq/boris": "1.0.*",
        "cakephp/debug_kit": "3.0.*-dev",
        "cakephp/bake": "dev-master",
        "cakephp/migrations": "dev-master"

If you look at this file, two of those lines are dependence that are not part of the default Cake install; instead they where added  with the require  command like so:

composer require intervention/image

( full install instructions are here: )

Intervention btw is a nice OO-image processing library that abstracts a lot of the native GD Library and Imagick commands.

Here’s another example on how to update from CakePHP 3 to 3.1 from the releases post ( )

composer require 'cakephp/cakephp:3.1.*'
composer require 'cakephp/debug_kit:3.2.*'
composer require 'cakephp/bake:1.1.*'


BTW, I’m running on Windows, if you use the Windows installer this will set-up your path file so you can use the shorter composer * commands, rather than php composer.phar *  – who doesn’t like less typing? The same section hows how to set-up this for Unix/MacOS.

composer self-update  – make sure the composer app itself is current – it will remind you if you don’t do this every few weeks.

composer dump-autoload  – this does a re-fresh of the class list that is created from