oneup / favicon-fetcher
List and download favicons from urls
Installs: 1 153
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 4
Forks: 0
Open Issues: 0
Requires
- php: >=8.2
- ext-dom: *
- ext-libxml: *
- spatie/url: ^2.3
- symfony/http-client-contracts: ^3.4
Requires (Dev)
README
use Oneup\FaviconFetcher\FaviconFetcher; use Oneup\FaviconFetcher\SizeParser; use Oneup\FaviconFetcher\Strategy\RelIconStrategy; use Oneup\FaviconFetcher\Strategy\AppleTouchIconStrategy; use Oneup\FaviconFetcher\UrlNormalizer; $httpClient = ... $sizeParser = new SizeParser(); $urlNormalizer = new UrlNormalizer(); $faviconFetcher = new FaviconFetcher($httpClient, [ new RelIconStrategy($sizeParser, $urlNormalizer), new AppleTouchIconStrategy($sizeParser, $urlNormalizer), ]); $collection = $faviconFetcher->fetch('https://1up.io'); $favicon = $collection->findOneByMinimumSize(32, 32); $contents = $faviconFetcher->download($favicon);