Skip to content
Upgrade tools for CakePHP meant to facilitate migrating from one version of the framework to another
PHP Shell Batchfile
Find file
New pull request
Pull request Compare This branch is 34 commits ahead, 24 commits behind cakephp:master.
Latest commit 5cc8f2d @dereuromark cs fixes

CakePHP Upgrade tool Build Status

Upgrade tools for CakePHP meant to facilitate migrating from CakePHP 2.x to 3.x.

Warning This tool is still under development and doesn't handle all aspects of migrating.


After downloading/cloning the upgrade tool, you need to install dependencies with composer

php composer.phar install

Once dependencies are installed you can start using the upgrade shell.


This tool is a split-off off the original CakePHP upgrade tool and provides additional fixers:

  • Locale (fixing locale files)
  • Model to Table (making the model files to Table class files)
  • Custom (tons of custom fixes)

Feel free to manually port those things back into the core one.


The upgrade tool provides a standalone application that can be used to upgrade other applications or cakephp plugins. Each of the subcommands accepts a path that points to the application you want to upgrade.

cd /path/to/upgrade
bin/cake upgrade all /home/mark/Sites/my-app
bin/cake upgrade skeleton /home/mark/Sites/my-app

The first command would run all the tasks at once on /home/mark/Sites/my-app, which is probably the way most people will want to use it. Additionally the second command would run the skeleton task on /home/mark/Sites/my-app. This command is not included in all as it is only necessary for apps. Plugins don't need it.

It is recommended that you keep your application in version control, and keep backups of before using the upgrade tool.

Order matters

Several of the commands have dependencies on each other and should be run in a specific order. It is recommended that you run the following commands first before using other commands:

bin/cake upgrade locations [path]
bin/cake upgrade namespaces [path]
bin/cake upgrade app_uses [path]

Once these three commands have been run, you can use the other commands in any order. The all command already used the right order by default.

Tasks Available


Move files/directories around. Run this before adding namespaces with the namespaces command.


Add namespaces to files based on their file path. Only run this after you have moved files.


Replace App::uses() with use statements


Rename classes that have been moved/renamed. Run after replacing App::uses().


Rename HelperCollection, ComponentCollection, and TaskCollection. Will also rename component constructor arguments and _Collection properties on all objects.


Updates the method names for a number of methods.


Updates the method signatures for a number of methods.


Update fixtures to use new index/constraint features. This is necessary before running tests.


Update test cases regarding fixtures.


Update translation functions regarding placeholders.


Add basic skeleton files and folders from the "app" repository.


Move view templates for prefixed actions to prefix subfolder. eg. Users/admin_index.ctp becomes Admin/Users/index.ctp. By default admin prefix is handled, you can run this task for other routing prefixes using --prefix=other as well.

Something went wrong with that request. Please try again.