Do you want to know how to Drupal?

Let's Drupal

How to check that module installed in Drupal 9?

if (\Drupal::service('module_handler')->moduleExists('locale')) {
  // your code here
}