Drupal - How can I use the UUID API?
I assume what you want to know is how to generate a UUID in Drupal 8, because there's really not much else that you can do ;)
Entities all have an UUID automatically, so if you store your data as a config or content entity, you just have to define the uuid entity key.
To generate a UUID yourself, you need the uuid service:
$uuid = \Drupal::service('uuid'); $uuid->generate(); $uuid->isValid($uuid_to_validate);
To generate uuid with drush:
drush php-eval "echo \Drupal::service('uuid')->generate();"