Skip to content

Commit 436d35d

Browse files
Add missing get_domain_name helper
1 parent c11b03f commit 436d35d

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

src/helpers.php

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,3 +60,20 @@ function is_external_url($url, $allowSubdomains = true) {
6060
}
6161
}
6262
}
63+
64+
if (! function_exists('get_domain_name')) {
65+
66+
/**
67+
* Get a domain name, without protocol
68+
* from a url.
69+
*
70+
* @param string $url
71+
* @return string
72+
*/
73+
function get_domain_name($url) {
74+
75+
$parse = parse_url($url);
76+
77+
return $parse['host'] ?? null;
78+
}
79+
}

0 commit comments

Comments
 (0)