How to add a custom module to a menu? I am using Drupal 7. I have just built a wonderful custom module. Now I need to add it to my main menu, under the parent item "Tools and Resources."

I know I can go to the homepage and click on the little gear and go to "List links", which will take me to admin/structure/menu/manage/main-menu/list?destination=node and I can click-and-hold on the little compass and drag-and-drop my module in the desired place. But, is there a way to do this through the PHP code in the module itself?
Menu items are nested using the item path. Take look to the paragraphs module:

/**
 * Implements hook_menu().
 */
function paragraphs_menu() {
  $items = array();
  $items['admin/structure/paragraphs'] = array(
    'title' =&gt; 'Paragraph Bundles',
    'description' =&gt; 'Manage Paragraph bundles',
    'page callback' =&gt; 'paragraphs_admin_bundle_overview',
    'access arguments' =&gt; array('administer paragraphs bundles'),
    'file' =&gt; 'paragraphs.admin.inc',
  );

  $items['admin/structure/paragraphs/list'] = array(
    'title' =&gt; 'List',
    'type' =&gt; MENU_DEFAULT_LOCAL_TASK,
    'weight' =&gt; -10,
  );

  $items['admin/structure/paragraphs/add'] = array(
    'title' =&gt; 'Add Paragraph Bundle',
    'page callback' =&gt; 'drupal_get_form',
    'page arguments' =&gt; array('paragraphs_admin_bundle_form'),
    'access arguments' =&gt; array('administer paragraphs bundles'),
    'type' =&gt; MENU_LOCAL_ACTION,
    'file' =&gt; 'paragraphs.admin.inc',
  );

  $items['admin/structure/paragraphs/%paragraphs_bundle'] = array(
    'title' =&gt; 'Edit paragraph bundle',
    'title callback' =&gt; 'paragraphs_bundle_title_callback',
    'title arguments' =&gt; array(3),
    'page callback' =&gt; 'drupal_get_form',
    'page arguments' =&gt; array('paragraphs_admin_bundle_form', 3),
    'access arguments' =&gt; array('administer paragraphs bundles'),
    'file' =&gt; 'paragraphs.admin.inc',
  );

  ...

  return $items;
}


Also if you want to add your menu item to an existing menu other than administration use the menu key. 

$items['menu-item'] = array(
  'title' =&gt; 'Foo bar',
  'page callback' =&gt; 'drupal_get_form',
  'page arguments' =&gt; array('foo_bar'),
  'menu' =&gt; 'user_menu'
);


Check the hook documentation for more information.