code: public static function autoLink($url, $custom = null)
      {
          $regex = '@(http)?(s)?(://)?(([-\w]+\.)+([^\s]+)+[^,.\s])@';
  
          if ($custom === null) {
              $replace = '<a href="http$2://$4">$1$2$3$4</a>';
          } else {
              $replace = '<a href="http$2://$4">' . $custom . '</a>';
          }
  
          return preg_replace($regex, $replace, $url);
      }
docs: Converts plain text URLS into HTML links.
  Second argument will be used as the URL label <a href=''>$custom</a>.
  
  @param string $url    → URL
  @param string $custom → if provided, this is used for the link label
  
  @return string → returns the data with links created around URLS