venture-oak-labs/favicon-generator-bundle

将跨平台favicon生成器的生成功能集成到您的Symfony应用程序中。

1.0.0 2015-10-08 08:27 UTC

This package is not auto-updated.

Last update: 2024-10-02 10:52:48 UTC


README

将跨平台favicon生成器RealFaviconGenerator的生成功能集成到您的Symfony应用程序中。

安装

使用composer获取bundle

在您的Symfony项目根目录的终端中运行以下命令添加RealFaviconGeneratorBundle

composer require venture-oak-labs/favicon-generator-bundle

启用bundle

要开始使用该bundle,请在您的应用程序的kernel类中注册该bundle

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

配置bundle

# app/config/config.yml
venture_oak_labs_favicon_generator:
    api_key: #required

如何使用

// 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'

有关可用选项的更多信息,请参阅:http://realfavicongenerator.net/api/non_interactive_api#.VgQ5Frw2tZ4

此bundle仍处于beta版本!