Skip to main content

realodix/urlhub

538 stars
2 code files
View realodix/urlhub on GitHub

composer.json

Open in GitHub
{
"require": {
"php": "^8.0",
//
"spatie/url": "^2.0",
},
}

app/Services/UrlService.php

Open in GitHub
use Spatie\Url\Url as SpatieUrl;
 
class UrlService
{
public function getDomain(string $url)
{
$url = SpatieUrl::fromString($url);
 
return urlSanitize($url->getHost());
}
}

We'd Love Your Feedback

Tell us what you like or what we can improve

Feel free to share anything you like or dislike about this page or the platform in general.