Source: divinglaravel.com

Job Encryption in Laravel

Category: Laravel

Consider this job: When you dispatch this job, Laravel is going to serialize it so that it can be persisted in the queue store. Let's take a look at how the final form will look like in the store: Looking at the payload, you can see that the value of socialSecurityNumber is visible to the human eye.

But if the job stores critical information in the payload, it's better we encrypt it so that only our queue workers can read it while processing the job. To do that, we'll need to implement the ShouldBeEncrypted interface: This interface was introduced in Laravel v8.19.0 (Released on December 15, 2020) Now the payload will look like this: Any person or program with access to the queue store will not be able to decrypt the job payload.
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