How To Generate an UUID in Laravel?

How To Generate an UUID in Laravel

Universally Unique Identifier or UUID as it is popularly known is a 128-bit number that is generally used to identify unique information. Being 36-character long, a UUID is considered a safe bet in generating uniquely identifiable strings every time.

Generating UUID in Laravel

Laravel can generate UUIDs out of the box and ready to be used.

The following code will generate a UUID in Laravel.

$generatedUUID      = Str::uuid();

That’s it. This will return an UUID.

UUID generated by the code above

A working example of the code can be found here.

Share This Post

Subscribe To my Future Posts

Get notified whenever I post something new

More To Explore

How To Use Google SIgn In In Flutter

How To Use Google Sign In Flutter?

This topic is divided into 2 parts. The parts are as follows: 1 – Creating a Firebase Project 2 – Configuring the Flutter app and