There is no license information available for the latest version (1.0.1) of this package.

A custom encrypter class that uses Laravel's Encrypter class with a custom key instead of the application key.

1.0.1 2018-11-11 18:39 UTC

This package is auto-updated.

Last update: 2024-05-12 06:34:50 UTC


This package uses Laravel's encryption but allows you to specify a custom passphrase instead of using the application key. This can be useful if some of the database data should be encrypted so that only someone with the passphrase can decrypt it.


Via Composer

$ composer require taylornetwork/encrypter


TaylorNetwork\Encrypter\Encrypter is ready to run right out of the box.


Instantiate TaylorNetwork\Encrypter\Encrypter

The class requires 1 parameter, the passphrase you want to encrypt/decrypt with.

$passphrase = 'secret 123';

$encrypter = new TaylorNetwork\Encrypter\Encrypter($passphrase);

Note: Laravel's Encrypter class requires a passphrase of exactly 16 characters, TaylorNetwork\Encrypter\Encrypter will lengthen or shorten the supplied passphrase and then encode it using base64 before passing it to Laravel's Encrypter class so that you can supply any length of passphrase you want.

Available Methods

encrypt (mixed $data)

Encrypts the data given or returns false if the encryption failed.

$data = 'This is some data to encrypt';




decrypt (string $encryptedData)

Decrypts the data given or returns false if the decryption failed.

$data = 'eyJpdiI6Ikc5aVdmUzhWcTRIM2xaMFZtQmVhamc9PSIsInZhbHVlIjoidFJmZHY3c1pcL25MZUtpOGlaM1NYa0JEY0FtbGtKTVVVZnRwaXJJbkNkU2srR3BPNlwvTlwvQ24xM0VUZ1lsc2xSMCIsIm1hYyI6ImZjYTU1YzU5NjFhYWM3NTNkOTFiNDk5YTNhMzIwMzhiMzQ0NjZhMDQyNWFjMTExZWVjY2QxOGM5NGExNmRjMGIifQ==';



'This is some data to encrypt'



The MIT License (MIT). Please see License File for more information.