Skip to main content

Posts

Showing posts with the label cakephp 4 upgrade

Cakephp 4: How to convert string to hash password

CakePHP 4: How to convert string to hash password This tutorial works for both CakePHP  3 and CakePHP 4. Sometimes we want to add custom login or wants to add custom login  or we want client side password hashing using cakephp Hash functions , so for that we need to use DefaultPasswordHasher which provides inbuilt functionality to check two passwords , compare it or convert a string to Hash etc. To use password hashing please follow below steps:- Step 1 Call a class after the namespace. use Cake\Auth\DefaultPasswordHasher; Step 2 Now we can use functions of DefaultPasswordHasher().  Use below code to change a simple string password to a secure string and its non reversible . $password = "My Password String"; $hasher = new DefaultPasswordHasher(); $newPassword = $hasher->hash($password);  Now if you print $newPassword to test its working or not, then you will get it an unique hash everytime on refresh, because CakePHP use different mechanism to handle hash that is ...

How to upgrade Cakephp 3 to Cakephp 4.x

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 ...