Laravel 5 – 13
PHP 5.6+
No commit activity in last 2 years
No release in over 2 years
Encrypt and decrypt strings in PHP.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
 Dependencies

Development

phpunit/phpunit
~8.0

Runtime

 Project Readme

Encrypter

GitHub release License Build Status Code Coverage Scrutinizer Code Quality Total Downloads

ko-fi

Encrypt and decrypt strings in PHP.

This package includes an adapter for Laravel's Encrypter that adheres to my Encrypter interface. This can be used in vanilla PHP. Other implementations might be added in the future.

Installation

Install this package through Composer:

composer require codezero/encrypter

Vanilla PHP Implementation

Autoload the vendor classes:

require_once 'vendor/autoload.php'; // Path may vary

Choose a key. You will need the same key that was used to encrypt a string, to decrypt it.

$key = 'my secret key';

And then use the DefaultEncrypter implementation:

$encrypter = new \CodeZero\Encrypter\DefaultEncrypter($key);

Usage

Encrypt a string

$encrypted = $encrypter->encrypt('some string');

Decrypt an encrypted string

try {
    $decrypted = $encrypter->decrypt($encrypted);
} catch (\CodeZero\Encrypter\DecryptException $exception) {
    // Decryption failed...
}

Testing

$ composer run test

Security

If you discover any security related issues, please e-mail me instead of using the issue tracker.

License

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