{"id":15026251,"url":"https://github.com/graciousagency/doctrine-encryption-bundle","last_synced_at":"2026-03-08T06:31:34.587Z","repository":{"id":33647610,"uuid":"160336808","full_name":"graciousagency/doctrine-encryption-bundle","owner":"graciousagency","description":"Simple bundle for adding encryption type to Doctrine","archived":false,"fork":false,"pushed_at":"2025-04-08T09:59:52.000Z","size":21,"stargazers_count":5,"open_issues_count":0,"forks_count":4,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-11-27T15:08:32.368Z","etag":null,"topics":["doctrine","doctrine-dbal","doctrine-encryption-bundle","doctrine2","encryption","hashing","libsodium-php","php72","php8","symfony-bundle","symfony4"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/graciousagency.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-12-04T10:02:16.000Z","updated_at":"2025-04-08T11:42:57.000Z","dependencies_parsed_at":"2025-02-15T20:32:24.832Z","dependency_job_id":"45c0f256-0bce-4aad-9652-011382701810","html_url":"https://github.com/graciousagency/doctrine-encryption-bundle","commit_stats":null,"previous_names":[],"tags_count":13,"template":false,"template_full_name":null,"purl":"pkg:github/graciousagency/doctrine-encryption-bundle","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/graciousagency%2Fdoctrine-encryption-bundle","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/graciousagency%2Fdoctrine-encryption-bundle/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/graciousagency%2Fdoctrine-encryption-bundle/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/graciousagency%2Fdoctrine-encryption-bundle/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/graciousagency","download_url":"https://codeload.github.com/graciousagency/doctrine-encryption-bundle/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/graciousagency%2Fdoctrine-encryption-bundle/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30247329,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-08T05:41:50.788Z","status":"ssl_error","status_checked_at":"2026-03-08T05:41:39.075Z","response_time":56,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["doctrine","doctrine-dbal","doctrine-encryption-bundle","doctrine2","encryption","hashing","libsodium-php","php72","php8","symfony-bundle","symfony4"],"created_at":"2024-09-24T20:04:08.870Z","updated_at":"2026-03-08T06:31:34.560Z","avatar_url":"https://github.com/graciousagency.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Gracious Doctrine Encryption Bundle\n\nSimple bundle to add 2 new types to Doctrine\n* encrypted\n* encryptedArrayCollection\n* hashed\n\nIt relies on libSodium for encryption\n\n## Installation\nThe Installation is quite simple: \n\n1. Require the Bundle via composer:\n```text\ncomposer require gracious/doctrine-encryption-bundle\n```\n2. Add the following to your doctrine.yaml:\n```yaml\ntypes:\n  encrypted: 'Gracious\\DoctrineEncryptionBundle\\Type\\Encrypted'\n  encryptedArrayCollection: 'Gracious\\DoctrineEncryptionBundle\\Type\\EncryptedArrayCollection'\n  hashed: 'Gracious\\DoctrineEncryptionBundle\\Type\\Hashed'\n```\n3. Generate a 64 character encryption key, you could to this the following way:\n```php\nsodium_bin2hex(random_bytes(SODIUM_CRYPTO_SECRETBOX_KEYBYTES));\n```\n4. Add the following two settings to your .env file:\n```text\nENABLE_ENCRYPTION=true\nENCRYPTION_KEY=[PASTE ENCRYPTION KEY HERE]\n```\n\n## Settings\nThere are 2 settings at the moment, both are env vars\n\n* ENABLE_ENCRYPTION - true / false \n\n* ENCRYPTION_KEY - 64 character hexadecimal string\n\n## Generating a key\nYou can do 2 things to generate a key, either type one yourself or run:\n\n```php\nsodium_bin2hex(random_bytes(SODIUM_CRYPTO_SECRETBOX_KEYBYTES));\n```\n\n## Nonce\nNonces are automatically generated for each encrypted value and are added to the returned value as follows:\n\n```text\n\u003cnonce|encrypted value\u003e\n```\n\n## Doctrine settings\nThe following has to be added to you doctrine.yaml\n\n```yaml\ntypes:\n  encrypted: 'Gracious\\DoctrineEncryptionBundle\\Type\\Encrypted'\n  encryptedArrayCollection: 'Gracious\\DoctrineEncryptionBundle\\Type\\EncryptedArrayCollection'\n  hashed: 'Gracious\\DoctrineEncryptionBundle\\Type\\Hashed'\n```\nThe block would look something like this:\n```yaml\ndoctrine:\n    dbal:\n        # configure these for your database server\n        driver: 'pdo_mysql'\n        server_version: '5.7'\n        charset: utf8mb4\n        default_table_options:\n            charset: utf8mb4\n            collate: utf8mb4_unicode_ci\n\n        # With Symfony 3.3, remove the `resolve:` prefix\n        url: '%env(resolve:DATABASE_URL)%'\n        types:\n          encrypted: 'Gracious\\DoctrineEncryptionBundle\\Type\\Encrypted'\n          encryptedArrayCollection: 'Gracious\\DoctrineEncryptionBundle\\Type\\EncryptedArrayCollection'\n          hashed: 'Gracious\\DoctrineEncryptionBundle\\Type\\Hashed'\n```\n\n## Usage\nTo use either of the 3 types in your entity just replace the column type with\n```text\n@ORM\\Column(type=\"encrypted\")\n```\nor\n```text\n@ORM\\Column(type=\"encryptedArrayCollection\")\n```\nor\n```text\n@ORM\\Column(type=\"hashed\")\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgraciousagency%2Fdoctrine-encryption-bundle","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgraciousagency%2Fdoctrine-encryption-bundle","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgraciousagency%2Fdoctrine-encryption-bundle/lists"}