bitverse/identicon-bundle

用于 bitverse/identicon 的 Symfony 2 扩展包。

安装: 328

依赖者: 0

建议者: 0

安全: 0

星标: 0

关注者: 2

分支: 2

开放问题: 1

类型:symfony-bundle

1.0.2 2015-11-01 22:43 UTC

This package is not auto-updated.

Last update: 2024-09-14 17:37:35 UTC


README

此包包含一个扩展包,该扩展包将 bitverseio/identicon 集成到 Symfony 应用程序中。

安装

使用 composer 下载扩展包

$ composer require bitverse/identicon-bundle

app/AppKernel.php 中启用扩展包

<?php

class AppKernel extends Kernel
{
    public function registerBundles()
    {
        $bundles = array(
            // ...

            new Bitverse\IdenticonBundle\BitverseIdenticonBundle(),
        );

        // ...
    }

    // ...
}

配置

BitverseIdenticonBundle 允许您指定预处理器和生成器类,以及 identicons 的背景颜色。以下是 YAML 格式的默认配置

bitverse_identicon:
    preprocessor:
        class: Bitverse\Identicon\Preprocessor\MD5Preprocessor
    generator:
        class: Bitverse\Identicon\Generator\PixelsGenerator
        background_color: #EEEEEE

使用方法

该扩展包提供了一个 identicon 服务,它是 Bitverse\Identicon\Identicon 的实例。您可以直接使用它来创建图标

$svg = $this->get('identicon')->getIcon('helloworld');

或者,如果您需要,您可以将其作为依赖项注入

services:
    my_service:
        arguments:
            - @identicon