How to upgrade Cakephp 3 to Cakephp 4.x
So Cakephp 4 is released and now cakephp did major changes is that :
1. Now cakephp using more typehinting and strict mode.
2. cakephp replaced .ctp file extension with .php so now all tempalates files have .php extension .
3. Now templates folder moved from src to root folder.
4. Some functions are now deprecarted that you can check on its official website .
Now today we learn how to upgrade Cakephp version to latest version. So keep follow below steps:-
1) Open terminal and go to the root directory folder
2) Then run below command to install upgrade tool
git clone git://github.com/cakephp/upgrade
3) Now above command will create upgrade folder in your root directory so change drive by using below command
cd upgrade
4. Now we need to install new files of cake 4 so run below command:
git checkout 4.x
5. Now run below command
composer install --no-dev
Ok so now we have all new updated file so now we need to change our old templates files extension to php also move folder to root, so for that we will run below commands in upgrade directory
Rename locale files
bin/cake upgrade file_rename locales ../
Rename template files
bin/cake upgrade file_rename templates ../
Above two command will make changes in your current project according to new cake version, then you need to change you update App.paths.locales and App.paths.templates paths to be correct.Then proceed to next step.
Now we need to run rector command so it can fix deprecated functions
bin/cake upgrade rector --rules phpunit80 ../tests
bin/cake upgrade rector --rules cakephp40 ../src
Now we need to upgrade all cakephp dependencies, so for that please run below commands:
composer require --update-with-dependencies "phpunit/phpunit:^8.0"
composer require --update-with-dependencies "cakephp/cakephp:4.0.*"
Note if your composer not installed globally then above command will show error so please run below command
php composer.phar require --update-with-dependencies "phpunit/phpunit:^8.0" php composer.phar require --update-with-dependencies "cakephp/cakephp:4.0.*"
Ok so if you run all commands successfully then now you can run frontend and you can see now your cakephp version is updated to cakephp 4
Thanks for the reading. :)
Related Links
Can you show how to migrate from cakephp 2.10.5 to cakephp 4? It will be really helpful
ReplyDeleteYour Affiliate Money Printing Machine is waiting -
ReplyDeleteAnd making money with it is as simple as 1---2---3!
Here is how it works...
STEP 1. Tell the system what affiliate products the system will promote
STEP 2. Add some PUSH button traffic (this LITERALLY takes 2 minutes)
STEP 3. Watch the affiliate products system grow your list and sell your affiliate products on it's own!
Are you ready to start making money??
You can test-drive the system for yourself risk free...
Your Affiliate Money Making Machine is waiting -
ReplyDeleteAnd making money online using it is as simple as 1-2-3!
Here are the steps to make it work...
STEP 1. Input into the system what affiliate products the system will push
STEP 2. Add some push button traffic (it LITERALLY takes JUST 2 minutes)
STEP 3. Watch the affiliate system grow your list and sell your affiliate products for you!
So, do you want to start making profits???
You can test-drive the system for yourself risk free...
According to Stanford Medical, It's indeed the ONLY reason this country's women live 10 years longer and weigh 42 lbs less than we do.
ReplyDelete(By the way, it has totally NOTHING to do with genetics or some secret-exercise and EVERYTHING related to "HOW" they are eating.)
P.S, What I said is "HOW", not "what"...
CLICK this link to determine if this easy test can help you unlock your true weight loss possibility
Your Affiliate Profit Machine is ready -
ReplyDeleteAnd getting it set up is as simple as 1--2--3!
It's super easy how it works...
STEP 1. Input into the system which affiliate products the system will advertise
STEP 2. Add some PUSH button traffic (it takes JUST 2 minutes)
STEP 3. Watch the system explode your list and sell your affiliate products all on it's own!
Do you want to start making money???
Click here to activate the system
It was a nice article. could you please show how to upgrade Cakephp 2.x-> CakePhP 3.x.
ReplyDeleteIt would be appreciated.
This comment has been removed by the author.
ReplyDelete