Le 13/06/2026 à 19:03, سپهر محمودی a écrit :
, Hi Internals
My name is Sepehr, and I am a web developer. I would like to request a
Wiki account to propose a new addition to the PHP core
Proposal: A built-in function to dynamically detect and return the
website's favicon URL (e.g., get_favicon()).
Motivation:
Currently, developers have to manually handle favicon paths. I have
developed a logic that automates this process by dynamically detecting
the favicon file within the project structure without requiring
parameters. I believe having a standard, built-in way to handle this
would improve the developer experience and make PHP more web-integrated.
Requested Username: Sepehrphp
Email: [email protected]
I have a working prototype and I am ready to start the RFC process.
Best regards,
Sepehrphp
HTML already defines a way to configure favicons using the <link
rel="icon"> tag and its internal parameters (media, type, etc.).
If no such link is defined in the HTML code, or if the page is not HTML
(pdf, json, image, etc.), most browsers will attempt at fetching the
"/favicon.ico" URL, which implies that it's becoming a standardized
method to both fetch an icon from a page AND create a fallback for any
HTTP server.
Plus, I wouldn't see the actual benefits of a "get_favicon()" function
that returns a "single URL", considering that the <link rel="icon">
tag's behavior is to adapt depending on several contextual information,
like "media" (which is basically a media-query), "type" (which is a
mime-type, allowing compatibility with lots of different formats) and
"sizes" which allows displaying different source media depending on the
final displayed size: the icon in the Windows taskbar will be smaller
than a shortcut for this website on a mobile's homepage, so the first
one can use a lightweight ".ico" image, and the last one can use a
scalable SVG for instance.
I'm curious about what exactly your RFC would provide.