Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Doctrine Extensions Bundle Laravel Package

dayploy/doctrine-extensions-bundle

View on GitHub
Deep Wiki
Context7

DayployDoctrineExtensionsBundle

Encrypt your sensitive data in your database.

/!\ There is a BC BREAK between v1 and v2, see UPGRADE.md /!\

How it works

Your property is in your entity but not stored directly in the database.

Before persisting in db, it is encrypted using a nonce and the encrypted value is stored in the encryptedValue.

The reverse process is done when the entity is loaded from the db.

Anyone that acces your db can not read the value without the encryption key.

Entity update

In your entity, add your cryptable property. This property is not stored in database.

It can be nullable or not, it depends of your context, but it must be a string.

In this example: $myValue.

The nonce and encrypted value must be stored in binary.

#[ORM\Entity()]
class MyClass
{
    #[Cryptable(
        nonceProperty: 'myValueNonce',
        encryptedProperty: 'myValueEncrypted',
    )]
    private ?string $myValue = null; // this value is not stored in DB

    #[ORM\Column(type: Types::BINARY, nullable: true)]
    private ?string $myValueEncrypted = null;
    #[ORM\Column(type: Types::BINARY, nullable: true)]
    private ?string $myValueNonce = null;

    ...
}

Configuration

Add the bundle to your project

composer require dayploy/doctrine-extensions-bundle

Enable the bundle

Add the bundle to config/bundles.php:

<?php

return [
    ...
    Dayploy\DoctrineExtensionsBundle\DayployDoctrineExtensionsBundle::class => ['all' => true],
];

Encryption Generation

First, generate a new DOCTRINE_ENCRYPTION_KEY:

./bin/console dayploy:doctrine-extensions:generate

put the generated DOCTRINE_ENCRYPTION_KEY in your .env

Of course, use an encryption key per environment ! Do not lose this encryption key, without it, your data is lost

Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
jayeshmepani/jpl-moshier-ephemeris-php
elnasnato/laraliveui
labrodev/rest-sdk
sampaui/sampaui
babelqueue/php-sdk
facebook/capi-param-builder-php
babelqueue/symfony
hamzi/corewatch
minionfactory/raw-hydrator
hexters/coinpayment
rjcodes/rjcms
act-training/laravel-permissions-manager
alimarchal/laravel-chart-of-accounts
babenkoivan/elastic-scout-driver
mkwebdesign/filament-watchdog-v5
renatomarinho/laravel-page-speed
zedmagdy/filament-business-hours
renatovdemoura/blade-elements-ui
devgeek/beacon-admin
benjamin-rqt/data-watcher-bundle