PHP code example of jdz / favicon

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

    

jdz / favicon example snippets


$config = array_merge([
  'filePath'      => '[PATH_TO_SOURCE_FILE]/favicon.png',
  'destPath'      => '[DESTINATION_PATH]/',
  'appName'       => 'Application name',
  'appShortName'  => 'AppName',
  'appLanguage'   => 'fr-FR',
  'appStartUrl'   => './?manifest=true',
  'appThemeColor' => '#F9F9F9',
  'appBgColor'    => '#F9F9F9',
  'appDisplay'    => 'standalone',
  'use64Icon'     => true,
  'use48Icon'     => true,
  'noOldApple'    => false,
  'noAndroid'     => false,
  'noMs'          => false,
], $testConfig);

$generator = new \JDZ\Favicon\Generator($config);

try {
  $generator->execute();
  
  // the info buffer stores the written files in an array
  $list_of_written_files = $generator->getInfoBuffer();
  echo "<pre>";
  print_r($list_of_written_files);
  echo "</pre>";
}
catch(\JDZ\Favicon\Exception\GeneratorException $e){
  echo $e->getMessage();
}