Skip to content

Instantly share code, notes, and snippets.

@robertogallea
Created May 8, 2020 08:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save robertogallea/4f1a73f316923576d6b0f2e96002c4fd to your computer and use it in GitHub Desktop.
Save robertogallea/4f1a73f316923576d6b0f2e96002c4fd to your computer and use it in GitHub Desktop.
$encrypter = new Illuminate\Encryption\Encrypter('1234567812345678', 'AES-128-CBC');
$encrypted = $encrypter->encrypt('Hello world');
dump($encrypted);
// prints something similar to "eyJpdiI6ImdMd2dWcW5jMXBrUDBranRJZXQ5MEE9PSIsInZhbHVlIjoiNnhTODBSclB3ZVp3SFRRUWFWTHpReFQwYWQ1aXVmTmhXOXV5WHM2TzR1WT0iLCJtYWMiOiIwODQyZDhiMzZlNDQwZTZjYTRiYmI2MGE0MTgzNzk5NGNkZTU1Yzc5NDIyYzdjYmYwNzk2ZTA5MGNjYjc4MGYzIn0="
$decrypted = $encoder->decrypt($encrypted);
dump($decrypted);
// prints "Hello world" again
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment