<?php
// LOAD
// You can load up the menu tree with MenuLinkTree::load, which will give you an array of menu links to work with. From there it's just a matter of looping through and getting what you need, e.g.
$tree = \Drupal::menuTree()->load('main', new \Drupal\Core\Menu\MenuTreeParameters());
foreach ($tree as $item) {
$title = $item->link->getTitle();
$url_obj = $item->link->getUrlObject();
$has_children = $item->hasChildren;
// etc...
}