Create a new Menu in Drupal 8 programmatically Is it possible to create a new Menu in Drupal 8 programmatically using a custom module? 

I am creating a custom module, and one of the requirements of the module is that it creates a new menu under Structure &gt; Menus.

Most of the tutorials teach how to add a menu link to an existing menu. For example, Creating menu links, Add a menu link, etc. 

In short, I need a way so that the end result is a menu below "User Account Menu" in the image, and then I can add my menu links to it, using above tutorials. 

Thanks.
Menus are configuration; you can include one in your module by adding a file named &lt;module_root&gt;/config/install/system.menu.foo.yml to your codebase (replacing foo with the desired menu ID).

The contents of the file will be something similar to one of the same configs installed by the core system module, e.g.

langcode: en
status: true
dependencies: {  }
id: foo
label: 'Foo menu'
description: 'Links related to foo'
locked: true


When the module is (re)installed, the menu will be created.

You could also technically use the API in a hook_install or similar:

$menu = \Drupal::entityTypeManager()-&gt;getStorage('menu')
  -&gt;create([
    'langcode' =&gt; 'en',
    'status' =&gt; TRUE,
    ...
  ]);


but the yml method is a bit cleaner, and I think recommended (can't find a source right now though).

As an aside, the menus are listed in alphabetical order. I don't think it would be straightforward to change that, menus have no concept of weight in relation to one another so you'd have to wedge that in somehow if you really need your menu at the bottom of the list.