Creating a menu link programmatically in Drupal 8 and 9 is easy. You have to provide four values, link title and Uri, menu name for which you want to create a menu link, and optionally you can provide a link weight.
Did you know that Drupal is available in 100 languages? Did you know that Drupal is 17 years old? Did you know that 56% of government websites are using Drupal? Find out more information about Drupal in this amazing infographic.
The best way to install Drupal 8 and 9 is by using Composer. There are several options, but the most widely used and easiest way is to use the Composer template for Drupal projects.
Hierarchical Taxonomy Menu is a Drupal 8 and 9 module for creating menus from taxonomy terms.