-
composer.json
Open in GitHub{ "require": { "php": "^8.0", // "spatie/url": "^2.0", }, }
-
app/Services/UrlService.php
Open in GitHubuse Spatie\Url\Url as SpatieUrl; class UrlService { public function getDomain(string $url) { $url = SpatieUrl::fromString($url); return urlSanitize($url->getHost()); } }