code: public static function isSsl()
      {
          $isSecure = false;
          if (isset($_SERVER['HTTPS']) && in_array($_SERVER['HTTPS'], ['on', '1'])) {
              $isSecure = true;
          } elseif (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https') {
              $isSecure = true;
          } elseif (isset($_SERVER['HTTP_X_FORWARDED_SSL']) && $_SERVER['HTTP_X_FORWARDED_SSL'] == 'on') {
              $isSecure = true;
          }
          return $isSecure;
      }
docs: Is ssl.
  
  @return boolean