PHP code example of alto / favicon

1. Go to this page and download the library: Download alto/favicon 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/ */

    

alto / favicon example snippets


use Alto\Favicon\Generator\FaviconGenerator;
use Alto\Favicon\Options\FaviconOptionsBuilder;

// 1. Configure options
$options = (new FaviconOptionsBuilder(
    inputFile: 'assets/logo.svg',
    outputDir: 'public/favicons'
))
    ->publicPath('/favicons')
    ->appName('My App')
    ->themeColor('#0b0b0b')
    ->build();

// 2. Generate
$generator = new FaviconGenerator();
$report = $generator->generate($options);

// 3. Use the result
echo "Generated " . count($report->files) . " files.\n";
echo "HTML Snippet:\n" . $report->htmlSnippet;