In this article, we will see how to encrypt and decrypt strings in laravel 9. As we all know laravel framework provides more security to the user and that's why laravel provide encrypt of password or string to the user, here we will see encrypt or decrypt a string in laravel 9. Laravel's encryption services provide a simple, convenient interface for encrypting and decrypting text via OpenSSL using AES-256 and AES-128 encryption. So, let's see encrypt decrypt a string in laravel 9, laravel 9 in encrypt a string, laravel 9 in decrypt string.

Example 1: password = Crypt::encrypt($data['password']); $user->save(); try { $decrypted = Crypt::decrypt($row->password);; } catch (DecryptException $e) { $e->getMessage(); info("Error....!!"); }}
Newsletter

Get the latest Laravel/PHP jobs, events and curated articles straight to your inbox, once a week

Glimpse streamlines Laravel development by seamlessly deploying GitHub pull requests to preview environments with the help of Laravel Forge. Glimpse streamlines Laravel development by seamlessly deploying GitHub pull requests to preview environments with the help of Laravel Forge.
Fathom Analytics | Fast, simple and privacy-focused website analytics. Fathom Analytics | Fast, simple and privacy-focused website analytics.
Shirts painstakingly handcrafted by under-caffeinated developers. Shirts painstakingly handcrafted by under-caffeinated developers.
Community Partners