tzsk / crypton
Laravel API Request Response Encryption
Fund package maintenance!
tzsk
paypal.me/KMAhmed
Installs: 6 059
Dependents: 0
Suggesters: 0
Security: 0
Stars: 39
Watchers: 4
Forks: 9
Open Issues: 9
Requires
- php: ^7.4
- illuminate/console: ^7.0|^8.0
- illuminate/encryption: ^7.0|^8.0
- illuminate/http: ^7.0|^8.0
- illuminate/support: ^7.0|^8.0
Requires (Dev)
- friendsofphp/php-cs-fixer: ^2.16
- laravel/legacy-factories: ^1.0
- orchestra/testbench: ^5.0|^6.0
- phpunit/phpunit: ^9.3
- vimeo/psalm: ^4.0
- dev-master
- 4.0.1
- 4.0.0
- 3.0.0
- 2.0.0
- 1.0.0
- dev-dependabot/composer/guzzlehttp/psr7-1.9.1
- dev-dependabot/composer/symfony/http-kernel-5.4.20
- dev-dependabot/add-v2-config-file
- dev-dependabot/composer/vimeo/psalm-4.9.2
- dev-dependabot/composer/friendsofphp/php-cs-fixer-3.0.1
- dev-dependabot/composer/phpunit/phpunit-9.5.8
- dev-dependabot/composer/orchestra/testbench-6.19.0
This package is auto-updated.
Last update: 2024-10-19 23:51:00 UTC
README
TThis is a simple package for laravel to encrypt decrypt api request & response in both ends, Backend & Javascript.
📦 Installation
Via Composer
$ composer require tzsk/crypton
Publish config file
$ php artisan crypton:publish
Add an environment variable in the .env
file
CRYPTON_KEY=your-encryption-key
👀 Keep in Mind
TIP: You can easily generate an encryption key by running
php artisan key:generate
then copy the generated key. Then again run:php artisan key:generate
to make the key used by crypton and the default application key 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\Middleware\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
🔬 Testing
composer test
📅 Changelog
Please see CHANGELOG for more information on what has changed recently.
👑 Contributing
Please see CONTRIBUTING for details.
🔒 Security Vulnerabilities
Please review our security policy on how to report security vulnerabilities.
❤️ Credits
👮♂️ License
The MIT License (MIT). Please see License File for more information.