code: private static function validateUrl(string $string): string
      {
          if (filter_var($string, FILTER_VALIDATE_URL) === false) {
              throw new \Exception("Invalid url : ${string}");
          }
          return $string;
      }
docs: Make Sure Url in string with correct url format
  @throws \Exception