$str = \Illuminate\Support\Str::random(32); $encrypter = new \Illuminate\Encryption\Encrypter($str,"AES-256-CBC"); $val = $encrypter->encrypt("hello2"); print_r($val); print_r($encrypter->decrypt($val));