You can generate random UUIDs without plugins in PhpStorm or other IntelliJ applications.
- Open PhpStorm Settings
- Go to
Editor > Live Templates
- Expand the PHP section
- Click on the Add button,
+
on the right side, and select Live template - In the abbreviation field, enter
uuid
. This is what we'll type to expand the template - In the template text field, enter
$VALUE$
- Click
Edit variables
- In the line for the variable named
VALUE
, add the expressiongroovyScript("UUID.randomUUID().toString()")
and selectSkip if defined
- Click
Define
below the⚠️ No applicable contexts
- Select the desired options where you want to generate UUIDs, i.e.
- For strings in PHP
PHP > String literal
- For strings in JSON
JSON > JSON string literal
- For strings in PHP
- Save and close the settings with the
Ok
button