Skip to content
Laravel Request & Response Encryption
Branch: master
Clone or download
Kazi Mainuddin Ahmed
Kazi Mainuddin Ahmed ScrutinizerCI Added
Latest commit df1222c Jan 24, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
config Apply fixes from StyleCI Jan 22, 2019
src Apply fixes from StyleCI Jan 22, 2019
tests Apply fixes from StyleCI Jan 22, 2019
.gitignore First Commit Jan 22, 2019
.scrutinizer.yml ScrutinizerCI Added Jan 24, 2019
.styleci.yml First Commit Jan 22, 2019
.travis.yml Travis CI & Style CI Jan 22, 2019
changelog.md First Commit Jan 22, 2019
composer.json Auto Discovery Jan 22, 2019
composer.lock First Commit Jan 22, 2019
contributing.md First Commit Jan 22, 2019
license.md First Commit Jan 22, 2019
phpunit.xml First Commit Jan 22, 2019
readme.md ScrutinizerCI Added Jan 24, 2019

readme.md

Crypton

Software License Latest Version on Packagist Total Downloads Build Status StyleCI Quality Score

This is a simple pakcage for laravel to encrypt decrypt api request & response in both ends, Backend & Javascript.

Installation

Via Composer

$ composer require tzsk/crypton

Configuration

If you are using Laravel 5.5 or above you don't need to add the provider and alias.

If you are using Laravel 5.4 or older add these in the config/app.php

'providers' => [
    //...
    'Tzsk\Crypton\CryptonServiceProvider',
],

Environment

Publish the config file by running the following command

$ php artisan vendor:publish --tag=tzsk-crypton

Add an environment veriable in the .env file

CRYPTON_KEY=your-encryption-key

TIP: You can easily generate an encryption key by running php artisan key:generate then copy the string after the base64:.... Then again run: php artisan key:generate to make the key used by crypton and the default application key is different.

WARNING: DO NOT USE THE SAME APP_KEY AND CRYPTON_KEY

Usage

Start off by adding a Middleware in the app/Http/Kernel.php file.

$routeMiddleware = [
    'crypton' => \Tzsk\Crypton\Middlewares\EncryptRequestResponse::class,
];

Now, add this middleware to any api routes or groups.

Example:

Route::middleware('crypton')->post('some-endpoint', function(Request $request) {
    return Post::paginate($request->per_page ? : 10);
});

That's it.

Javascript adapter

See Laravel Crypton

For Android & iOS integration packages are coming soon.

Change log

Please see the changelog for more information on what has changed recently.

Testing

$ composer test

Contributing

Please see contributing.md for details and a todolist.

Security

If you discover any security related issues, please email mailtokmahmed@gmail.com instead of using the issue tracker.

Credits

License

MIT. Please see the license file for more information.

You can’t perform that action at this time.