Re: [Discussion] Proposal: get_favicon() helper function
| From: | kasper Sanguesa-Franz | Date: | Mon, 15 Jun 2026 16:09:01 +0000 |
| Subject: | Re: [Discussion] Proposal: get_favicon() helper function | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-131283@lists.php.net to get a copy of this message | ||
From my perspective it sounds more like a composer package than a PHP core function On 15 Jun 2026
17:35, سپهر محمودی <sepehrphpr@gmail.com> wrote:
Hi internals,
My name is Sepehr and I would like to propose a small helper function for PHP that extracts the
favicon URL of a given page.
The function takes a URL, fetches the HTML, and returns the favicon URL as a string.
Possible signature:
get_favicon(string $url): ?string
The function would scan the HTML for common favicon declarations such as:
<link rel=“icon” href=“…”>
<link rel=“shortcut icon” href=“…”>
<link rel=“apple-touch-icon” href=“…”>
If a favicon link is found, the function returns the URL. If not, it returns null.
The goal is to provide a simple built-in helper for a common task in web utilities and crawlers.
I would appreciate feedback on this. If it seems reasonable, I’d like to draft an RFC and request
a wiki account to create the proposal page.
Best regards,
Sepehr