venture-oak-labs / favicon-generator-bundle
Integrate generation of a multiplatform favicon with RealFaviconGenerator into your Symfony application.
Installs: 68
Dependents: 0
Suggesters: 0
Security: 0
Stars: 8
Watchers: 1
Forks: 2
Open Issues: 2
Type:symfony-bundle
Requires
- php: >=5.4
- symfony/framework-bundle: ~2.3
This package is not auto-updated.
Last update: 2024-05-15 08:58:44 UTC
README
Integrate generation of a multiplatform favicon with RealFaviconGenerator into your Symfony application.
Installation
Get the bundle using composer
Add RealFaviconGeneratorBundle by running this command from the terminal at the root of your Symfony project:
composer require venture-oak-labs/favicon-generator-bundle
Enable the bundle
To start using the bundle, register the bundle in your application's kernel class:
// app/AppKernel.php public function registerBundles() { $bundles = array( // ... new VentureOakLabs\FaviconGeneratorBundle\VentureOakLabsFaviconGeneratorBundle(), // ... ); }
Configure bundle
# app/config/config.yml venture_oak_labs_favicon_generator: api_key: #required
How to use
// 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'
Further reading about the available options: http://realfavicongenerator.net/api/non_interactive_api#.VgQ5Frw2tZ4