Skip to content

Replace a symbol with an image from a service

kayzore edited this page Nov 24, 2016 · 2 revisions

Replace a symbol with an image from a service

  • Step 1 : Declare the SmileyBundle Service
myService.Service:
    class:      My\Path\
    arguments:  [@kay_smiley.smiley]
  • Step 2 : Usage in your custom service
<?php
use Kay\SmileyBundle\Services\Smiley;

private $smiley;

public function __construct(Smiley $smiley)
{
    $this->smiley = $smiley;
}

public function myCustomFunction($message)
{
    $textFormat = $this->smiley->checkSmiley($message);
    return $textFormat;
}

Clone this wiki locally