dragonwize / doctrine-postgres-ulid
Doctrine type for Postgres pgx_ulid extension.
Installs: 15
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 0
Forks: 0
Open Issues: 0
pkg:composer/dragonwize/doctrine-postgres-ulid
Requires
- php: ^8.2
- doctrine/dbal: ^4.0
This package is auto-updated.
Last update: 2026-01-06 21:08:16 UTC
README
Doctrine DBAL column type for Postgres pgx_ulid extension.
Requirements
Technically, this can (for now) be used with any DB type that is ulid in the DB.
However, this will probably diverge in the future.
This is designed to work with the Postgresql extension pgx_ulid.
The pgx_ulid extension or some other extension that provides the ulid column type
to Postgres must be installed for this to work.
Usage
Symfony
https://symfony.com/doc/current/doctrine/dbal.html#registering-custom-mapping-types
# config/packages/doctrine.yaml doctrine: dbal: types: pgx_ulid: \Dragonwize\Doctrine\Type\PgxUlidType
Doctrine Direct
For use in Symfony consider using symfony/doctrine-bridge
symfony/doctrine-bridge provides a ULID Doctrine DBAL type already and it works in more DB's and situations. The doctrine-bridge version is great if you need the flexibility it provides.
This ulid type is desgined for simplicity in a specific scenario.
- You must be using a DB that uses the
ulidcolumn type. (eg. Postgres with pgx_ulid) - That type must be returned as a standard 26 char string.
- You must provide the ULID genaration. symfony/uid component is one option for this. @todo Later this will support using DB based generation.
Under those conditions we can use a simple string type instead of an object as the PHP value which greatly simplifies value handling in many scenarios.