Introduction
At the end of July 2025, I tagged and released v3.9.0 of my Favicon Fetcher package.
This release introduced a new driver that allows you to fetch favicons using the DuckDuckGo Icons API.
So I thought I'd put together a quick blog post to announce the new feature.
What is Favicon Fetcher?
Favicon Fetcher is a Laravel package I built that allows you to easily fetch favicons for any website.
For example, to get the favicon for https://ashallendesign.co.uk
, you can use the following code:
1use AshAllenDesign\FaviconFetcher\Facades\Favicon;2 3$favicon = Favicon::fetch('https://ashallendesign.co.uk');
This will return an instance of AshAllenDesign\FaviconFetcher\Favicon
, which contains information about the fetched favicon, such as its URL, size, and MIME type. You can then store the favicon in your file storage, cache the metadata, and more.
If you're interested in learning more about the package, I have a more in-depth article here: How to Get Website's Favicons in Laravel.
Or, you can check out the GitHub repository here: github.com/ash-jc-allen/favicon-fetcher.
Fetching Favicons with DuckDuckGo
Now let's quickly cover how to fetch favicons using the new DuckDuckGo driver.
Let's imagine we want to fetch the favicon for ashallendesign.co.uk
using the DuckDuckGo Icons API. We can do this by calling the driver
method on the Favicon
facade and passing duck-duck-go
as the argument:
1use AshAllenDesign\FaviconFetcher\Facades\Favicon; 2 3$favicon = Favicon::driver('duck-duck-go')->fetch('https://ashallendesign.co.uk'); 4 5// $favicon is now an instance of AshAllenDesign\FaviconFetcher\Favicon 6 7// You can then store the favicon in your file storage 8$faviconPath = $favicon->store('favicons', 's3'); 9 10// $faviconPath is now equal to: "/favicons/abc-123.ico"11 12// You can also cache the favicon metadata for a day13$favicon = $favicon->cache(now()->addDay());
Although you can explicitly define which driver to use on each call, you can also set the DuckDuckGo driver as the default driver in your config/favicon-fetcher.php
configuration file:
1return [ 2 3 /* 4 |-------------------------------------------------------------------------- 5 | Default Driver 6 |-------------------------------------------------------------------------- 7 | 8 | The driver that should be used by default for fetching the favicons. 9 | By default, the package comes with support for several drivers,10 | but you can define your own if needed.11 |12 | Supported drivers: "http", "google-shared-stuff", "favicon-kit",13 | "unavatar", "favicon-grabber", "duck-duck-go"14 |15 */16 'default' => 'duck-duck-go',17];
This then means that you can fetch favicons using the DuckDuckGo driver without needing to specify it each time:
1use AshAllenDesign\FaviconFetcher\Facades\Favicon;2 3$favicon = Favicon::fetch('https://ashallendesign.co.uk');
Conclusion
And that's it! Although it's a relatively small addition to the package, I like that it gives users another option for fetching favicons.
If you enjoyed reading this post, you might be interested in checking out my 220+ page ebook "Battle Ready Laravel" which covers similar topics in more depth.
Or, you might want to check out my other 440+ page ebook "Consuming APIs in Laravel" which teaches you how to use Laravel to consume APIs from other services.
If you're interested in getting updated each time I publish a new post, feel free to sign up for my newsletter below.
Keep on building awesome stuff! 🚀