2017 © Pedro Peláez
 

library encrypter

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

image

taylornetwork/encrypter

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

  • Thursday, November 17, 2016
  • by taylornetwork
  • Repository
  • 1 Watchers
  • 0 Stars
  • 1 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

Custom Encrypter for Laravel

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., (*1)

Install

Via Composer, (*2)

``` bash $ composer require taylornetwork/encrypter, (*3)


## Setup `TaylorNetwork\Encrypter\Encrypter` is ready to run right out of the box. ## Usage Instantiate `TaylorNetwork\Encrypter\Encrypter` The class requires 1 parameter, the passphrase you want to encrypt/decrypt with. ``` php $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., (*4)

Available Methods

encrypt (mixed $data)

Encrypts the data given or returns false if the encryption failed., (*5)

``` php $data = 'This is some data to encrypt';, (*6)

$encrypter->encrypt($data);, (*7)


Returns ``` php 'eyJpdiI6Ikc5aVdmUzhWcTRIM2xaMFZtQmVhamc9PSIsInZhbHVlIjoidFJmZHY3c1pcL25MZUtpOGlaM1NYa0JEY0FtbGtKTVVVZnRwaXJJbkNkU2srR3BPNlwvTlwvQ24xM0VUZ1lsc2xSMCIsIm1hYyI6ImZjYTU1YzU5NjFhYWM3NTNkOTFiNDk5YTNhMzIwMzhiMzQ0NjZhMDQyNWFjMTExZWVjY2QxOGM5NGExNmRjMGIifQ=='

decrypt (string $encryptedData)

Decrypts the data given or returns false if the decryption failed., (*8)

``` php $data = 'eyJpdiI6Ikc5aVdmUzhWcTRIM2xaMFZtQmVhamc9PSIsInZhbHVlIjoidFJmZHY3c1pcL25MZUtpOGlaM1NYa0JEY0FtbGtKTVVVZnRwaXJJbkNkU2srR3BPNlwvTlwvQ24xM0VUZ1lsc2xSMCIsIm1hYyI6ImZjYTU1YzU5NjFhYWM3NTNkOTFiNDk5YTNhMzIwMzhiMzQ0NjZhMDQyNWFjMTExZWVjY2QxOGM5NGExNmRjMGIifQ==';, (*9)

$encrypter->decrypt($data);, (*10)


Returns ``` php 'This is some data to encrypt'

Credits

License

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

The Versions

17/11 2016

dev-master

9999999-dev

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

  Sources   Download

The Requires

 

by Sam Taylor

17/11 2016

1.0.0

1.0.0.0

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

  Sources   Download

The Requires

 

by Sam Taylor