Since we will write the code, you will want to have a custom module. Creating a custom module in Drupal is simple: create a folder and an info.yml file. For this recipe, we will create a folder under /modules in your Drupal folder called drupalform.
In the drupalform folder, create drupalform.info.yml. Drupal will parse the info.yml file to discover modules. An example of a module's info.yml file is as follows:
name: Drupal form example description: Create a basic Drupal form, accessible from a route type: module version: 1.0 core: 8.x
The name will be your module's name, and the description will be listed on the Extend page. Specifying the core tells Drupal what version of Drupal it is built for. Chapter 4, Extending Drupal, covers how to create a module in depth.