PHP code example of venture-oak-labs / favicon-generator-bundle

1. Go to this page and download the library: Download venture-oak-labs/favicon-generator-bundle 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/ */

    

venture-oak-labs / favicon-generator-bundle example snippets


// app/AppKernel.php
public function registerBundles()
{
    $bundles = array(
        // ...
        new VentureOakLabs\FaviconGeneratorBundle\VentureOakLabsFaviconGeneratorBundle(),
        // ...
    );
}

// The bundle provides a service to generate the favicons package based on a set of options.
$generator = $this->container->get('venture_oak_labs.favicon_generator.generator');

// Options
$options = array(
    'general' => array(
        'src' => # Required ( URL For image or image content encoded in Base64),
        'icons_path' => # Defaults to 'root'
    ),
    'design' => array( 
        'desktop_browser', # By default provides Design for the classic desktop browsers. Configure the other as you like!
        'ios',
        'windows',
        'firefox_app',
        'android_chrome',
        'coast',
        'yandex_browser'
    ),
    'settings' => array(
        'compression',
        'scaling_algorithm',
        'error_on_image_too_small'
    )
);

$response = $generator->generate($options)

// The generated files have an available limit time. You can download and unpack them.
$response->downloadAndUnpack($outputDirectory, $directoryName) # Directory Name defaults to 'favicon_package'