gubler/uuid-encoder-bundle

This bundle provides Symfony integration for gubler/uuid-encoder.

Installs: 52

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 3

Forks: 0

Type:symfony-bundle

v0.3.0 2021-06-17 12:43 UTC

This package is auto-updated.

Last update: 2024-11-13 19:37:02 UTC


README

This bundle provides Symfony integration for gubler/uuid-encoder with some helper utilities and twig extensions.

This autowires/autoconfigures the following classes:

  • UuidEncoder
  • UrlUuidEncoder
  • FilesystemUuidEncoder

Each has default character sets (which characters are used to encode the UUID). UrlUuidEncoder and FilesystemUuidEncoder are wrappers around UuidEncoder that define a default character set.

You can configure the character set for each class by updating the config/packages/gubler_uuid_encoder.yaml file (shown here with defaults:

gubler_uuid_encoder:
    charset:
        default: ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789
        url: ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_~.
        filesystem: ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789

You can also use the following Twig extensions for encoding UUIDs in your templates:

{# data.id is a UUID #}

Encoded UUID with UuidEncoder is {{ data.id|uuidEncoder }}

Encoded UUID with UrlUuidEncoder is {{ data.id|urlUuid }}

Encoded UUID with FilesystemUuidEncoder is {{ data.id|filesystemUuid }}