a50/uuid

Uuid Provider for A50

Maintainers

Details

github.com/a50dev/uuid

Source

Issues

Installs: 4

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 1

Forks: 0

Open Issues: 0

Type:project

dev-main 2023-12-07 03:44 UTC

This package is auto-updated.

Last update: 2024-11-07 06:07:23 UTC


README

Uuid Provider


The main purpose of this package is to provide a provider to generate uuid.

Latest Version on Packagist Tests Analysis Total Downloads

Installation

You can install the package via composer:

composer require a50/uuid

Usage

Usually you need to generate a uuid in the repository implementation:

<?php

declare(strict_types=1);

namespace Project\Reviews\Infrastructure\Persistence;

use A50\Uuid\UuidProvider;
use Project\Reviews\Domain\ReviewId;
use Project\Reviews\Domain\ReviewRepository;

final class ReviewRepositoryUsingDbal implements ReviewRepository
{
    private UuidProvider $uuidProvider;

    public function __construct(UuidProvider $uuidProvider)
    {
        $this->uuidProvider = $uuidProvider;
    }

    public function nextIdentity(): ReviewId
    {
        return ReviewId::fromString($this->uuidProvider::next());
    }
    
    // ...
}

You can use UuidServiceProvider as definitions for container.

Testing

make test

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

License

The MIT License (MIT). Please see License File for more information.