2017 © Pedro Peláez
 

symfony-bundle uuid-paramconverter

A sensi paramconverter for receiving uuids as url params

image

mcfedr/uuid-paramconverter

A sensi paramconverter for receiving uuids as url params

  • Friday, February 23, 2018
  • by mcfedr
  • Repository
  • 2 Watchers
  • 4 Stars
  • 10,095 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 3 Forks
  • 0 Open issues
  • 9 Versions
  • 34 % Grown

The README.md

Uuid Extra Bundle

A convenient bundle for using ramsey/uuid in your project, (*1)

Latest Stable Version License Build Status, (*2)

Install

Composer

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

AppKernel

Include the bundle in your AppKernel, (*3)

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

Config

No config needed, (*4)

Param Converter

Use just like any other param converter, (*5)

/**
 * @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, (*6)

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

Also works for optional params, (*7)

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

Serializer

Also like a normalizer should, (*8)

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

Results in "f13a5b20-9741-4b15-8120-138009d8e0c7", (*9)

And the other way around, (*10)

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

Results in $uuid, (*11)

Works in your Objects etc., (*12)

Form Type

Does everything you'd expect, (*13)

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

And if your model has, (*14)

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

It will automatically use the UuidType, (*15)

The Versions

23/02 2018

dev-master

9999999-dev https://github.com/mcfedr/uuid-paramconverter

A sensi paramconverter for receiving uuids as url params

  Sources   Download

MIT

The Requires

 

The Development Requires

by Fred Cox

uuid identifier guid bundle symfony converter param paramconverter

23/02 2018

2.3.1

2.3.1.0 https://github.com/mcfedr/uuid-paramconverter

A sensi paramconverter for receiving uuids as url params

  Sources   Download

MIT

The Requires

 

The Development Requires

by Fred Cox

uuid identifier guid bundle symfony converter param paramconverter

22/02 2018

2.3.0

2.3.0.0 https://github.com/mcfedr/uuid-paramconverter

A sensi paramconverter for receiving uuids as url params

  Sources   Download

MIT

The Requires

 

The Development Requires

by Fred Cox

uuid identifier guid bundle symfony converter param paramconverter

22/02 2018

2.2.0

2.2.0.0 https://github.com/mcfedr/uuid-paramconverter

A sensi paramconverter for receiving uuids as url params

  Sources   Download

MIT

The Requires

 

The Development Requires

by Fred Cox

uuid identifier guid bundle symfony converter param paramconverter

15/11 2017

2.1.0

2.1.0.0 https://github.com/mcfedr/uuid-paramconverter

A sensi paramconverter for receiving uuids as url params

  Sources   Download

MIT

The Requires

 

The Development Requires

by Fred Cox

uuid identifier guid bundle symfony converter param paramconverter

30/11 2016

2.0.1

2.0.1.0 https://github.com/mcfedr/uuid-paramconverter

A sensi paramconverter for receiving uuids as url params

  Sources   Download

MIT

The Requires

 

The Development Requires

by Fred Cox

uuid identifier guid bundle symfony converter param paramconverter

30/11 2016

2.0.0

2.0.0.0 https://github.com/mcfedr/uuid-paramconverter

A sensi paramconverter for receiving uuids as url params

  Sources   Download

MIT

The Requires

 

The Development Requires

by Fred Cox

uuid identifier guid bundle symfony converter param paramconverter

30/11 2016

dev-uuid3

dev-uuid3 https://github.com/mcfedr/uuid-paramconverter

A sensi paramconverter for receiving uuids as url params

  Sources   Download

MIT

The Requires

 

The Development Requires

by Fred Cox

uuid identifier guid bundle symfony converter param paramconverter