Download the PHP package odandb/doctrine-ciphersweet-encryption-bundle without Composer

On this page you can find all versions of the php package odandb/doctrine-ciphersweet-encryption-bundle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package doctrine-ciphersweet-encryption-bundle

Doctrine Ciphersweet Encryption Bundle

Introduction

This bundle aims to make life easier to developers who want to set encrypted fields in their entities thanks to Ciphersweet library. This bundle is inspired from the talk given at Afup ForumPHP : REX sur le chiffrement de base de données. We also used the WIP public repository : https://github.com/PhilETaylor/doctrine-ciphersweet.

Install

Step 1: Download the Bundle

Add this repositories section on your composer.json project.

And run

Step 2: Enable the Bundle

Usage

1. Setup DOCTRINE_CIPHERSWEET_KEY environment key

This bundle comes with several commands and annotations/attributes but first of all, you'll need to setup the DOCTRINE_CIPHERSWEET_KEY secret environment key. First of all, you can just init a random one in your environment file.

Next you can generate your final key with this command :

You can even chain it with the Symfony's secrets manager like this :

Then remove the entry in your .env file

2. Add annotations / attributes to your entities

This bundle comes with 2 annotations / attributes in order to set encryption fields :

EncrytedField

This annotation/attribute comes with 3 options:

IndexableField

This annotation/attribute comes with 4 options:

3. Generating indexes

To make the entities searchable, the library provides a feature called "Blind Index" which is a unique index calculated from the original value. By default, we provide a default index field to every encrypted ones (using the $indexable option). If you need to setup a search of values starting by a term, you'll need the IndexableField annotation/attribute and set a dedicated indexes table. This dedicated entity must implement the Odandb\DoctrineCiphersweetEncryptionBundle\Entity\IndexedEntityInterface and you can use the Odandb\DoctrineCiphersweetEncryptionBundle\Entity\IndexedEntityTrait to make your life easier.

Basically, this table will be composed of those columns :

You must be careful with the indexation process :
How to generate indexes while not using $autoRefresh option :

The bundle comes with a Symfony indexes generation command :

The classname to enter is the original entity classname, not the indexes one. If we refer to the full example section, it would be :

If you need to speedup things (in case of high volume), you can even activate a parallel mode :

In this mode, the command will split the work in smaller chuncks and start subprocesses for each one. Refer to the command for more informations.

4. Here is a full example :


All versions of doctrine-ciphersweet-encryption-bundle with dependencies

PHP Build Version
Package Version
Requires php Version >=8.2
ext-mbstring Version *
doctrine/doctrine-bundle Version ^2.8.0
doctrine/orm Version ^2.14 || ^3.4
paragonie/ciphersweet Version ^3.0 || ^4.0
symfony/config Version ^6.4 || ^7.0
symfony/console Version ^6.4 || ^7.0
symfony/dependency-injection Version ^6.4 || ^7.0
symfony/deprecation-contracts Version ^2.5 || ^3.2
symfony/framework-bundle Version ^6.4 || ^7.0
symfony/http-kernel Version ^6.4 || ^7.0
symfony/process Version ^6.4 || ^7.0
symfony/property-access Version ^6.4 || ^7.0
symfony/property-info Version ^6.4 || ^7.0
symfony/service-contracts Version ^2.2 || ^3.2
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package odandb/doctrine-ciphersweet-encryption-bundle contains the following files

Loading the files please wait ...