Encrypting data with Laravel
I am a self-taught developer currently in Salt Lake City. Currently, work in Laravel but have experience in plain PHP, PERL, and CakePHP.
Entrepreneurial VP of tech and CTO with a strong grasp of both the business and engineering. PHP developer for 10 years with experience in CakePHP and Laravel
Since Laravel 8.12 encryption is now a part of the model casts. There's no longer any need for traits to encrypt and decrypt.
In Laravel making a field encrypted is as easy as:
class User extends Model
{
public $casts = [
'critical_information' => 'encrypted',
];
}
Laravel can also handle JSON, arrays, and objects. Check the docs for more information.