Laravel Helper Function: encrypt

November 20, 2016 —John Koster

encrypt($value)

The encrypt helper function can be used to encrypt a given $value. The function resolves the configured Illuminate\Contracts\Encryption\Encrypter implementation from the Service Container and then calls the encrypt method on the Encrypter instance.

The following examples are all equivalent:

1<?php
2 
3use Illuminate\Support\Facades\Crypt;
4 
5// Encrypt using the Crypt facade:
6Crypt::encrypt('Hello, Universe');
7 
8// Encrypt using the encrypt helper:
9encrypt('Hello, Universe');

Some absolutely amazing
people

The following amazing people help support this site and my open source projects ♥️
If you're interesting in supporting my work and want to show up on this list, check out my GitHub Sponsors Profile.