Pimple Service Provider for working with Ben Ramsey's ramsey/uuid package
$ composer require germania-kg/uuidserviceprovider
<?php
use Germania\UuidServiceProvider\UuidServiceProvider;
// A. Use with Slim or Pimple
$app = new \Slim\App;
$dic = $app->getContainer();
$dic = new Pimple\Container;
// B. Register Service Provider.
$dic->register( new UuidServiceProvider );
Factory: Returns a new version 4 (random) UUID object as Ramsey\Uuid\Uuid instance.
<?php
$uuid4 = $dic['UUID.new'];
Returns the hex string representation of a UUID.new object.
<?php
$uuid4_hex = $dic['UUID.new.hex'];
Returns a callable that returns UUID object as Ramsey\Uuid\Uuid instance.
<?php
$factory = $dic['UUID.Factory'];
$uuid4 = $factory();
Returns a callable that returns the hex string representation of a UUID.new object.
<?php
$factory = $dic['UUID.HexFactory'];
$uuid4_hex = $factory();
$ git clone https://github.com/GermaniaKG/UuidServiceProvider.git
$ cd UuidServiceProvider
$ composer install
Either copy phpunit.xml.dist
to phpunit.xml
and adapt to your needs, or leave as is. Run PhpUnit test or composer scripts like this:
$ composer test
# or
$ vendor/bin/phpunit