Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

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

Awesome Lists containing this project

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