Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Uuid Extra Bundle Laravel Package

ekreative/uuid-extra-bundle

View on GitHub
Deep Wiki
Context7

Uuid Extra Bundle

A convenient bundle for using ramsey/uuid in your project

Latest Stable Version License Build Status

Install

Composer

php composer.phar require ekreative/uuid-extra-bundle

AppKernel

Include the bundle in your AppKernel

public function registerBundles()
{
    $bundles = array(
        ...
        new Ekreative\UuidExtraBundle\EkreativeUuidExtraBundle()

Config

No config needed

Param Converter

Use just like any other param converter

/**
 * @ParamConverter("uuid", class="Ramsey\Uuid\UuidInterface")
 * @Route("/simple/{uuid}")
 */
public function simpleAction(UuidInterface $uuid)
{
    return new Response($uuid->toString());
}

Most of the time its going to work automatically, as long as you use type hinting on your action

/**
 * @Route("/automatic/{uuid}")
 */
public function simpleAction(UuidInterface $uuid)
{
    return new Response($uuid->toString());
}

Also works for optional params

/**
 * @Route("/optional/{uuid}")
 */
public function simpleAction(UuidInterface $uuid = null)
{
    return new Response($uuid ? $uuid->toString() : 'no uuid');
}

Serializer

Also like a normalizer should

$this->serializer->serialize($uuid, 'json')

Results in "f13a5b20-9741-4b15-8120-138009d8e0c7"

And the other way around

$this->serializer->denormalize('"f13a5b20-9741-4b15-8120-138009d8e0c7"', UuidInterface::class, 'json')

Results in $uuid

Works in your Objects etc.

Form Type

Does everything you'd expect

->add('uuid', UuidType:class)

And if your model has

/**
 * @Assert\Uuid
 */
private $uuid;

It will automatically use the UuidType

Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
comsave/common
alecsammon/php-raml-parser
chrome-php/wrench
lendable/composer-license-checker
typhoon/reflection
mesilov/moneyphp-percentage
mike42/gfx-php
bookdown/themes
aura/view
aura/html
aura/cli
povils/phpmnd
nayjest/manipulator
omnipay/tests
psr-mock/http-message-implementation
psr-mock/http-factory-implementation
psr-mock/http-client-implementation
voku/email-check
voku/urlify
rtheunissen/guzzle-log-middleware