mediagone/small-uid-doctrine

Provides Doctrine types for mediagone/small-uid package.

0.7.0 2024-12-11 12:40 UTC

This package is auto-updated.

Last update: 2024-12-11 12:41:16 UTC


README

⚠️ This project is in experimental phase, the API may change any time.

Latest Version on Packagist Total Downloads Software License

Provides Doctrine types for mediagone/small-uid package:

  • SmallUidType: binary (8 bytes)

Installation

This package requires PHP (64-bit) 7.4+ and Doctrine DBAL 2.7+

Add it as Composer dependency:

$ composer require mediagone/small-uid-doctrine

With Symfony

If you're using this package in a Symfony project, register Small UID custom type in doctrine.yaml:

doctrine:
    dbal:
        types:
            smalluid: Mediagone\SmallUid\Doctrine\SmallUidType

Note: smalluid being the type name you'll use in your Entity mappings, you can pick whatever name you wish.

As standalone

Custom types can also be used separately, but need to be registered in Doctrine DBAL like this:

use Doctrine\DBAL\Types\Type;
use Mediagone\SmallUid\Doctrine\SmallUidType;

Type::addType(SmallUidType::NAME, SmallUidType::class);
// or, with a custom name:
Type::addType('smalluid', SmallUidType::class);

License

Small UID for Doctrine is licensed under MIT license. See LICENSE file.