# Create snippet phpstorm (ok)

```
Ctrl+Alt+S 
```

1. Press Ctrl+Alt+S to open IDE settings and select Editor | Live Templates.

Go to `Setting`s and start typing `"live templates"` in the search box. On the right panel you can edit and create such templates.

![](https://929787348-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MRtlBk287z48lyi_B98%2F-MaqeozIfcqej_0NVUUD%2F-MaqeqoiPigrDtzgjXTv%2Fimage.png?alt=media\&token=70770590-5d96-4614-977e-ff914d1da23d)

<https://www.jetbrains.com/help/phpstorm/creating-and-editing-live-templates.html>

## Create live templates﻿ <a href="#creating_and_editing_live_templates.xml" id="creating_and_editing_live_templates.xml"></a>

Last modified: 14 May 2021

The following example procedure illustrates how to create a template for a `TODO` comment with the current date and user name.

1. Press Ctrl+Alt+S to open IDE settings and select Editor | Live Templates.
2. Select the template group where you want to create a new live template (for example, other).

   If you do not select a template group, the live template will be added to the user group.
3. Click ![the Add button](https://resources.jetbrains.com/help/img/idea/2021.1/icons.general.add.svg) and select Live Template.
4. In the Abbreviation field, specify the characters that will be used to expand the template. For example: `todo`.
5. (Optional) In the Description field, describe the template for reference in the future.

   For example: `Insert TODO comment with the current date and username`
6. In the Template text field, specify the body of the template with [variables](https://www.jetbrains.com/help/phpstorm/template-variables.html).

   For example: `//TODO $DATE$ $USER$: $END$`
7. Click Edit variables to define the variables using [functions](https://www.jetbrains.com/help/phpstorm/template-variables.html#predefined_functions):

   | Name | Expression | Default value | Skip if defined |
   | ---- | ---------- | ------------- | --------------- |
   | DATE | date()     | None          | Yes             |
   | USER | user()     | None          | Yes             |

   You can set a default value for cases when the expression fails to evaluate, although these particular functions should always return a valid value. You can also disable the Skip if defined option for a variable to highlight the expanded value and let the user modify it if necessary.
8. Apply all your changes.
9. In the editor, type `todo` and press Tab.

   Depending on the current system date and username, the template should expand to something like:`//TODO 02.07.2019 jsmith:`
