Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ellipsephp/cookie-encryption
Psr-15 middleware allowing to encrypt cookies using defuse/php-encryption
https://github.com/ellipsephp/cookie-encryption
cookie encryption middleware psr-15 psr-7
Last synced: 3 months ago
JSON representation
Psr-15 middleware allowing to encrypt cookies using defuse/php-encryption
- Host: GitHub
- URL: https://github.com/ellipsephp/cookie-encryption
- Owner: ellipsephp
- License: mit
- Created: 2017-11-18T18:22:43.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2023-05-01T12:58:16.000Z (over 1 year ago)
- Last Synced: 2024-07-13T12:23:27.782Z (4 months ago)
- Topics: cookie, encryption, middleware, psr-15, psr-7
- Language: PHP
- Homepage: https://github.com/ellipsephp/cookie-encryption
- Size: 11.7 KB
- Stars: 4
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
- awesome-psr15-middlewares - ellipsephp/cookie-encryption - Encrypt cookies with a key (Packages / Security)
README
# Cookie encryption
This package provides a [Psr-15 middleware](https://www.php-fig.org/psr/psr-15/) allowing to encrypt cookies using [defuse/php-encryption](https://github.com/defuse/php-encryption).
**Require** php >= 7.3
**Installation** `composer require ellipse/cookie-encryption`
**Run tests** `./vendor/bin/kahlan`
- [Getting started](#getting-started)
# Getting started
This middleware takes an instance of `Defuse\Crypto\Key` from the [defuse/php-encryption](https://github.com/defuse/php-encryption) package and an array of bypassed cookie names as parameters. It will use defuse encryption mechanism to decrypt the cookies attached to the Psr-7 request and encrypt the cookies attached to the Psr-7 response. The cookies with a name in the bypassed array will stay untouched. When the decryption fails for one cookie, its value is set as an empty string.
```php