How to find out if an entity type is provided by core or a contrib/custom module? How can I find out which module is providing a particular entity type? I'm implementing hook_entity_type_alter() in a custom module, and I want to identify the entities that are provided by core. Is there a way to get information about the module that implements an entity type, so that I can gets its origin (set in core/lib/Drupal/Core/Extension/ExtensionDiscovery.php) or its package (set in module.info.yml)?
You can make use of module handler to get path to extension info file.

/**
 * Implements hook_entity_type_alter().
 */
function example_entity_type_alter(array &amp;$entity_types) {
  $module_handler = \Drupal::moduleHandler();
  foreach ($entity_types as $entity_type =&gt; $entity_type_info) {
    $provider = $entity_types['block']-&gt;getProvider();
    $module = $module_handler-&gt;getModule($provider);
    $info_file = $module-&gt;getPathname();
    drupal_set_message("$entity_type ---&gt; $provider ($info_file)");
  }
}