|
| 1 | +6.0 Upgrade Guide |
| 2 | +################# |
| 3 | + |
| 4 | +First, check that your application is running on latest CakePHP 5.x version. |
| 5 | + |
| 6 | +Fix Deprecation Warnings |
| 7 | +======================== |
| 8 | + |
| 9 | +Once your application is running on latest CakePHP 5.x, enable deprecation warnings in **config/app.php**:: |
| 10 | + |
| 11 | + 'Error' => [ |
| 12 | + 'errorLevel' => E_ALL, |
| 13 | + ] |
| 14 | + |
| 15 | +Now that you can see all the warnings, make sure these are fixed before proceeding with the upgrade. |
| 16 | + |
| 17 | +Some potentially impactful deprecations you should make sure you have addressed |
| 18 | +are: |
| 19 | + |
| 20 | +To be defined |
| 21 | + |
| 22 | +Upgrade to PHP 8.4 |
| 23 | +================== |
| 24 | + |
| 25 | +If you are not running on **PHP 8.4 or higher**, you will need to upgrade PHP before updating CakePHP. |
| 26 | + |
| 27 | +.. note:: |
| 28 | + CakePHP 6.0 requires **a minimum of PHP 8.4**. |
| 29 | + |
| 30 | +.. _upgrade-tool-use: |
| 31 | + |
| 32 | +Use the Upgrade Tool |
| 33 | +==================== |
| 34 | + |
| 35 | +.. note:: |
| 36 | + The upgrade tool only works on applications running on latest CakePHP 5.x. You cannot run the upgrade tool after updating to CakePHP 6.0. |
| 37 | + |
| 38 | +To help expedite fixing tedious changes there is an upgrade CLI tool: |
| 39 | + |
| 40 | +.. code-block:: console |
| 41 | +
|
| 42 | + # Install the upgrade tool |
| 43 | + git clone https://github.com/cakephp/upgrade |
| 44 | + cd upgrade |
| 45 | + git checkout 6.x |
| 46 | + composer install --no-dev |
| 47 | +
|
| 48 | +With the upgrade tool installed you can now run it on your application or |
| 49 | +plugin:: |
| 50 | + |
| 51 | + bin/cake upgrade rector --rules cakephp60 <path/to/app/src> |
| 52 | + |
| 53 | +Update CakePHP Dependency |
| 54 | +========================= |
| 55 | + |
| 56 | +After applying rector refactorings you need to upgrade CakePHP, its plugins, PHPUnit |
| 57 | +and maybe other dependencies in your ``composer.json``. |
| 58 | +This process heavily depends on your application so we recommend you compare your |
| 59 | +``composer.json`` with what is present in `cakephp/app |
| 60 | +<https://github.com/cakephp/app/blob/6.x/composer.json>`__. |
| 61 | + |
| 62 | +After the version strings are adjusted in your ``composer.json`` execute |
| 63 | +``composer update -W`` and check its output. |
| 64 | + |
| 65 | +Update app files based upon latest app template |
| 66 | +=============================================== |
| 67 | + |
| 68 | +Next, ensure the rest of your application has been updated to be based upon the |
| 69 | +latest version of `cakephp/app |
| 70 | +<https://github.com/cakephp/app/blob/6.x/>`__. |
0 commit comments