code: public function getClientIP()
      {
          $ip = null;
          $client = $this->server('HTTP_CLIENT_IP');
          $forward = $this->server('HTTP_X_FORWARDED_FOR');
          $remote = $this->server('REMOTE_ADDR');
  
          if (filter_var($client, FILTER_VALIDATE_IP)) {
              $ip = $client;
          } elseif (filter_var($forward, FILTER_VALIDATE_IP)) {
              $ip = $forward;
          } else {
              $ip = $remote;
          }
  
          return $ip;
      }
docs: Get Client IP Address.
  
  @return string