I've been searching for a way to check in PHP if the maintenance mode of my Drupal website is enabled, but I only found some solutions for Drupal 7, which doesn't seem to work on D8.
Have got any ideas?
Thank you.
The maintenance mode of the site is a boolean value stored in a state. You can access it like this:
$state = \Drupal::state()->get('system.maintenance_mode');