PHP code example of luispabon / favicon-finder

1. Go to this page and download the library: Download luispabon/favicon-finder library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

luispabon / favicon-finder example snippets




$guzzle = new \GuzzleHttp\Client();

// You can use any PSR-16 implementation here - if you have none and don't care
// about caching, simply use the provided dummy cache implementation below
$cache = new \FaviconFinder\DummyCache();

// Cache lifetime in seconds (default is 86400 or 1 day)
$ttl = 60;

$favicon = new \FaviconFinder\Favicon($guzzle, $cache, $ttl);

echo $favicon->get('https://github.com/luispabon/favicon-finder');

// Displays: https://github.com/favicon.ico
var_dump($favicon->get('http://nofavicon.tld'));
// Returns null